CI: Use 'gh release' to upload assets to release#3187
Merged
Conversation
michaelgrund
approved these changes
Apr 21, 2024
weiji14
reviewed
Apr 21, 2024
| with: | ||
| upload_url: ${{ github.event.release.upload_url }} | ||
| asset_path: baseline-images.zip | ||
| run: gh release upload ${{ github.ref_name }} baseline-images.zip |
Member
There was a problem hiding this comment.
The blog post you linked uses github.event.release.tag_name instead of github.ref_name. I had a look at https://docs.github.com/en/actions/learn-github-actions/contexts#github-context, and I suppose they're the same for tags (e.g. v0.12.0), but I suppose github.ref_name would be safer if we need to re-run the workflow, say if the dvc pull step failed?
Member
Author
There was a problem hiding this comment.
Just triggered another run of the workflow in my own fork (https://github.com/seisman/pygmt/actions/runs/8772441014/job/24079741738).
gh release upload v0.12.0 baseline-images.zip
shell: /usr/bin/bash -e {0}
env:
GH_TOKEN: ***
github.ref_name is v0.12.0 for the manually triggered run. I guess github.ref_name is better.
weiji14
approved these changes
Apr 22, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of proposed changes
Use
gh releaseto upload assets to release, so we don't need to use theshogo82148/actions-upload-release-assetaction anymore.Reference: https://michael-mckenna.com/how-to-upload-file-to-github-release-in-a-workflow/
The same commit was pushed to my own fork (https://github.com/seisman/pygmt). See https://github.com/seisman/pygmt/actions/runs/8772441014 for the workflow run and the testing release https://github.com/seisman/pygmt/releases/tag/v0.12.0.