Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from Oct 10, 2022

Conversation

0x2b3bfa0
Copy link
Contributor

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

@0x2b3bfa0 0x2b3bfa0 temporarily deployed to Build, sign, release binaries October 9, 2022 04:27 Inactive
When you use expressions in an if conditional, you may omit the expression syntax ${{ }} because GitHub automatically evaluates the if conditional as an expression.

https://docs.github.com/en/actions/learn-github-actions/expressions
@0x2b3bfa0 0x2b3bfa0 temporarily deployed to Build, sign, release binaries October 9, 2022 04:39 Inactive
@0x2b3bfa0 0x2b3bfa0 temporarily deployed to Build, sign, release binaries October 9, 2022 04:55 Inactive
@0x2b3bfa0 0x2b3bfa0 marked this pull request as ready for review October 9, 2022 04:59
@FiloSottile
Copy link
Owner

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
Copy link
Contributor Author

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
Copy link
Owner

That all makes sense, thank you!

@FiloSottile FiloSottile merged commit e05ce26 into FiloSottile:main Oct 10, 2022
@0x2b3bfa0 0x2b3bfa0 deleted the patch-1 branch October 10, 2022 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants