-
Notifications
You must be signed in to change notification settings - Fork 694
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
rules_docker release github workflow #2106
Merged
Merged
Changes from 7 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
5db9ed4
release github workflow
kriscfoster 25253d5
this is my feature
kriscfoster fc67c41
another feature
kriscfoster 53e225a
Merge pull request #1 from kriscfoster/some-branch
kriscfoster 7cc2c26
Merge pull request #2 from kriscfoster/another-feature
kriscfoster a9d612e
revert newlines
kriscfoster 93f821e
re-trigger
kriscfoster 467ed76
make url dynamic
kriscfoster 88ed8f3
re-add strip_prefix
kriscfoster 873f554
Merge pull request #3 from kriscfoster/pr-comments
kriscfoster db18ae9
empty commit to re-trigger ci
kriscfoster 5c8dfca
release
kriscfoster File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,47 @@ | ||||||
# This GitHub workflow is triggered when a new tag is pushed. | ||||||
# A release is then created from this tag. | ||||||
|
||||||
name: Release | ||||||
|
||||||
on: | ||||||
push: | ||||||
tags: | ||||||
- "v*.*.*" | ||||||
|
||||||
jobs: | ||||||
build: | ||||||
runs-on: ubuntu-latest | ||||||
|
||||||
steps: | ||||||
- name: Get pushed tag | ||||||
id: get_tag | ||||||
run: echo ::set-output name=TAG::${GITHUB_REF/refs\/tags\//} | ||||||
|
||||||
- name: Download repository archive at pushed tag | ||||||
run: "curl -L https://github.com/${{ github.repository_owner }}/${{ github.event.repository.name }}/archive/refs/tags/${{ steps.get_tag.outputs.TAG }}.tar.gz -o rules_docker-${{ steps.get_tag.outputs.TAG }}.tar.gz" | ||||||
|
||||||
- name: Get SHA256 of archive | ||||||
id: get_sha | ||||||
run: echo "::set-output name=sha::$(sha256sum rules_docker-${{ steps.get_tag.outputs.TAG }}.tar.gz | cut -f 1 -d ' ')" | ||||||
|
||||||
- name: Get version | ||||||
id: get_version | ||||||
run: | | ||||||
VERSION=${{ steps.get_tag.outputs.TAG }} | ||||||
echo "VERSION=${VERSION:1}" >> $GITHUB_ENV | ||||||
|
||||||
- name: Create Release | ||||||
uses: softprops/action-gh-release@v1 | ||||||
with: | ||||||
body: | | ||||||
Copy the following into your WORKSPACE file to use rules_docker at release ${{ steps.get_tag.outputs.TAG }} | ||||||
``` | ||||||
http_archive( | ||||||
name = "io_bazel_rules_docker", | ||||||
sha256 = "${{ steps.get_sha.outputs.sha }}", | ||||||
strip_prefix = "rules_docker-${{ env.VERSION }}", | ||||||
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/${{ steps.get_tag.outputs.TAG }}/rules_docker-${{ steps.get_tag.outputs.TAG }}.tar.gz"], | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense, updated to be more dynamic. The generated release information works automatically for forks now as-well. |
||||||
) | ||||||
``` | ||||||
generate_release_notes: true | ||||||
files: rules_docker-${{ steps.get_tag.outputs.TAG }}.tar.gz |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we may be able to remove the need for the strip_prefix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @uhthomas, I actually think I prefer to leave it in so we don't need to extract/recpompress things as that feels a little unnatural. However, if we want to remove it at a later stage we would just need to:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm.
We could use git archive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even better, we could make
tar.zst
archives. Smaller and faster to compress/decompress. Though this would require Bazel 5.2.0. Maybe both? I guess we can do this in a follow up PR. Just wanted to write this down somewhere.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah doing that in a follow up makes sense. I can probably look at it, but won't get a chance this week. Could be good to try what we have here so far with the next release anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you happy to try the git archive thing? It would be really nice to remove the requirement for
strip_prefix
as most other rulesets don't for major releases. If you don't have time, I'm happy to add a commit?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can probably get to this next week but if you'd like to try it in the meantime, feel free to add a commit. Otherwise, I'll try next week.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@uhthomas actually had some time this evening & pushed the change so
strip_prefix
isn't needed. Your suggestion worked. Basically, the extracted parent dir just needs to match the name of the tar & thenstrip_prefix
isn't needed sogit archive
works a treat. Thank you!