-
Notifications
You must be signed in to change notification settings - Fork 3
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
Enable release workflow with branch protection #57
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
b200013
Clean changelog
MattiSG 4b34612
Import branch protection bypass from engine
MattiSG 028b46c
Use action option to publish git tags
MattiSG d1f334f
Rely on action to push to target branch
MattiSG bb985c2
Optimise action performance
MattiSG a540240
Prevent double test runs
MattiSG f38c07c
Prevent workflow run on automatic commits
MattiSG 7c8c648
Ease testing
MattiSG 995af32
Rely on protection settings to ignore reviews
MattiSG 36b7dfb
Stop requiring release bot to be admin
MattiSG f12eecc
Revert "Use action option to publish git tags"
MattiSG 9ced530
Refactor tagging step
MattiSG 4eccec2
Validate changelog only in PRs targeting main
MattiSG b1bf93f
Unify comments style
MattiSG 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
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 |
---|---|---|
@@ -1,8 +1,9 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request_target: | ||
branches: [ main, test-main ] | ||
types: [ closed ] | ||
|
||
jobs: | ||
changelog: | ||
|
@@ -12,6 +13,7 @@ jobs: | |
uses: ./.github/workflows/test.yml | ||
|
||
release: | ||
if: github.event.pull_request.merged == true | ||
needs: [ changelog, test ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
@@ -30,13 +32,18 @@ jobs: | |
git config user.name "Open Terms Archive Release Bot" | ||
git config user.email "[email protected]" | ||
git commit --message="Update changelog" CHANGELOG.md package.json package-lock.json | ||
git push origin | ||
[ ${{ needs.changelog.outputs.release-type }} != 'no-release' ] && git tag v${{ steps.update-changelog.outputs.version }} | ||
|
||
- name: Tag commit | ||
if: needs.changelog.outputs.release-type != 'no-release' | ||
run: | | ||
git tag v${{ steps.update-changelog.outputs.version }} | ||
git push origin --tags | ||
- name: Run status checks for release commit on temporary branch # use temporary branch to enable pushing commits to this branch protected by required status checks | ||
uses: CasperWA/push-protected@v2 | ||
with: | ||
token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }} | ||
branch: main | ||
acceptable_conclusions: 'success,skipped' # changelog checks are skipped when not in a PR towards main branch | ||
tags: true | ||
interval: 10 # seconds between checks | ||
pre_sleep: 15 | ||
fail_fast: true | ||
|
||
- name: Publish to NPM public repository | ||
if: needs.changelog.outputs.release-type != 'no-release' | ||
|
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
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
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.
This will become the default value in the next release, see CasperWA/push-protected#250.