A GitHub Action for uploading files to Blossom with Nostr authentication using the blossom-cli tool.
- Upload files to Blossom using Nostr authentication
- Automatic installation of the blossom-cli tool
- File hash verification
- Detailed output including URL and hash
| Input | Description | Required | Default |
|---|---|---|---|
host |
Blossom host URL | Yes | https://blossom.swissdash.site |
filePath |
Path to the file to upload | Yes | - |
nostrPrivateKey |
Nostr private key (must be in nsec format) | Yes | - |
cliVersion |
Version of blossom-cli to use | No | latest |
| Output | Description |
|---|---|
url |
URL of the uploaded file |
hash |
Hash of the uploaded file |
success |
Whether the upload was successful (true/false) |
error |
Error message if upload failed |
- 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 }}"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.
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
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.
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
MIT