-
Notifications
You must be signed in to change notification settings - Fork 603
Automate release process based on deployment #4393
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
Merged
+78
−0
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f7f72df
add automated releases
functionzz c346972
update checkout sha, rename TAG_EXISTS, remove cta, restore exit 0 an…
functionzz 40a8445
add pat implementation
functionzz c3568ab
reinstate GH_TOKEN, sidestep sbom, change release.yml
functionzz 4014de6
Update .github/workflows/release_actions.yml
functionzz 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 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| changelog: | ||
| categories: | ||
| - title: Dependencies | ||
| labels: | ||
| - dependencies | ||
| - title: Changes | ||
| labels: | ||
| - '*' |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| name: Automated Release | ||
| on: | ||
| schedule: | ||
| - cron: "0 23 * * *" | ||
| permissions: {} | ||
|
|
||
| jobs: | ||
| release: | ||
| name: New release | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| pull-requests: read | ||
| steps: | ||
| - name: Clone repository | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
| fetch-depth: 0 | ||
| - name: Fetch deployed revision | ||
| id: revision | ||
| run: | | ||
| SHA=$(curl -fsS --max-time 10 \ | ||
| https://pontoon.mozilla.org/static/revision.txt | tr -d '[:space:]') | ||
|
|
||
| if ! printf '%s' "$SHA" | grep -qE '^[0-9a-f]{40}$'; then | ||
| echo "::error::Expected a 40-character commit hash, got: ${SHA:-<empty>}" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Deployed revision: $SHA" | ||
| echo "sha=$SHA" >> "$GITHUB_OUTPUT" | ||
| - name: Check for an existing release tag | ||
| id: check | ||
| env: | ||
| SHA: ${{ steps.revision.outputs.sha }} | ||
| run: | | ||
| if ! git cat-file -e "${SHA}^{commit}" 2>/dev/null; then | ||
| echo "::error::Commit $SHA is not in this repository." | ||
| exit 1 | ||
| fi | ||
|
|
||
| TAG_EXISTS=$(git tag --points-at "$SHA" | grep '^v202' || true) | ||
|
|
||
| if [ -n "$TAG_EXISTS" ]; then | ||
| echo "Already released as ${TAG_EXISTS}." | ||
| echo "release=false" >> "$GITHUB_OUTPUT" | ||
| exit 0 | ||
| fi | ||
|
|
||
| VERSION="$(date -u +v%Y.%m.%d)" | ||
|
|
||
| if [ -n "$(git tag -l "$VERSION")" ]; then | ||
| echo "::error::Tag $VERSION already exists." | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | ||
| echo "release=true" >> "$GITHUB_OUTPUT" | ||
| - name: Create GitHub Release | ||
| if: steps.check.outputs.release == 'true' | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| VERSION: ${{ steps.check.outputs.version }} | ||
| SHA: ${{ steps.revision.outputs.sha }} | ||
| run: | | ||
| gh release create "$VERSION" \ | ||
| --target "$SHA" \ | ||
| --title "Release $VERSION" \ | ||
| --generate-notes | ||
Oops, something went wrong.
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.
Can we run this a bit earlier?
I think we could safely run this at 20 or 21 UTC.
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 actually recommended 23:00 UTC explicitly, as it's a time that'll most certainly associate the calver date with the day when the deployment actually happened.
The idea is that this'll be looking backwards to find and tag the last prod release made on that day, and that if necessary, we'll amend the release notes on the following day.