Blossom CLI Uploader Action
A GitHub Action for uploading files to Blossom with Nostr authentication using the blossom-cli tool.
Features
Upload files to Blossom using Nostr authentication
Automatic installation of the blossom-cli tool
File hash verification
Detailed output including URL and hash
Inputs
InputDescriptionRequiredDefaulthost
Blossom host URLYeshttps://blossom.swissdash.sitefilePath
Path to the file to uploadYes-nostrPrivateKey
Nostr private key (must be in nsec format)Yes-cliVersion
Version of blossom-cli to useNolatest
Outputs
OutputDescriptionurl
URL of the uploaded filehash
Hash of the uploaded filesuccess
Whether the upload was successful (true/false)error
Error message if upload failed
Example Usage
- name: Upload to Blossom
id: blossom_upload
uses: c03rad0r/cli-blossom-uploader-go@main
with:
host: "https://blossom.swissdash.site"
filePath: "path/to/file.zip"
nostrPrivateKey: ${{ secrets.NSEC }}
- name: Use Upload Result
if: steps.blossom_upload.outputs.success == 'true'
run: |
echo "File uploaded to: ${{ steps.blossom_upload.outputs.url }}"
echo "File hash: ${{ steps.blossom_upload.outputs.hash }}"
Private Key Format
This action requires your Nostr private key to be in nsec format (starting with 'nsec'). If you have a hex format key, you'll need to convert it to nsec format before using this action.
How It Works
The action performs the following steps:
Sets up Go 1.22 in the GitHub Actions environment
Installs the blossom-cli tool from source
Validates that the provided private key is in nsec format
Calculates the SHA256 hash of the file to be uploaded
Uploads the file to the specified Blossom host
Extracts the URL and hash from the upload response
Sets the outputs for use in subsequent steps
Error Handling
If the upload fails, the action will set the success
output to false
and provide the error message in the error
output. The action will exit with a non-zero status code in case of failure.
Testing
You can test this action using the provided test workflow in .github/workflows/test-blossom-upload.yml
. This workflow:
Generates a random test file
Uploads it to Blossom
Verifies the upload was successful
Downloads the file back
Compares the original and downloaded file hashes to ensure integrity
License
MIT