FiloSottile / age

A simple, modern and secure encryption tool (and Go library) with small explicit keys, no config options, and UNIX-style composability.
https://age-encryption.org
BSD 3-Clause "New" or "Revised" License
15.79k stars 477 forks source link

.github/workflows: use gh to upload release artifacts #455

Closed 0x2b3bfa0 closed 1 year ago

0x2b3bfa0 commented 1 year ago

Uses gh release upload for the sake of pipeline code golfing, if that's a thing.

FiloSottile commented 1 year ago

Oh, thanks, this is definitely better. Why GH_REPO and why GH_TOKEN instead of GITHUB_TOKEN as documented in https://docs.github.com/en/actions/using-workflows/using-github-cli-in-workflows.

0x2b3bfa0 commented 1 year ago

_Why GH_REPO_

Because the upload job does not use the checkout action. Thus, when gh is run, it won't find a Git repository nor know where to upload the artifacts.

$ git release upload ...
fatal: not a git repository (or any of the parent directories): .git
/usr/local/bin/git: exit status 128

The easiest ways of specifying the target repository are either specifying the --repo option or setting the GH_REPO environment variable.

_Why GH_TOKEN instead of GITHUB_TOKEN_

Just for foolish consistency with the GH_REPO environment variable; feel free to use GITHUB_TOKEN if you deem it more appropriate. The same applies for github.token versus secrets.GITHUB_TOKEN to retrieve it.

FiloSottile commented 1 year ago

That all makes sense, thank you!