README.md

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

InputDescriptionRequiredDefaulthostBlossom host URLYeshttps://blossom.swissdash.sitefilePathPath to the file to uploadYes-nostrPrivateKeyNostr private key (must be in nsec format)Yes-cliVersionVersion of blossom-cli to useNolatest

Outputs

OutputDescriptionurlURL of the uploaded filehashHash of the uploaded filesuccessWhether the upload was successful (true/false)errorError 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:

  1. Sets up Go 1.22 in the GitHub Actions environment

  2. Installs the blossom-cli tool from source

  3. Validates that the provided private key is in nsec format

  4. Calculates the SHA256 hash of the file to be uploaded

  5. Uploads the file to the specified Blossom host

  6. Extracts the URL and hash from the upload response

  7. 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:

  1. Generates a random test file

  2. Uploads it to Blossom

  3. Verifies the upload was successful

  4. Downloads the file back

  5. Compares the original and downloaded file hashes to ensure integrity

License

MIT

Repository Details

name / identifier

cli-blossom-uploader-go

nostr clone url

nostr://npub1c03rad0r6q833vh57kyd3ndu2jry30nkr0wepqfpsm05vq7he25slryrnw/cli-blossom-uploader-go
just install ngit and run
git clone nostr://...

description

A simple blossom upload action that uses blossom-cli

git servers

https://github.com/c03rad0r/cli-blossom-uploader-go.git

maintainers

relays

wss://nos.lol/
wss://bitcoiner.social/
wss://relay.damus.io/
wss://relay.primal.net/

earliest unique commit

9544a5a682eda2a99c7ae660476628b4c6a33085

gitworkshop.dev logo GitWorkshop.dev