-
Notifications
You must be signed in to change notification settings - Fork 779
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
ci: Add a workflow for creating releases #3804
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
7c5c550
ci: Add a workflow for creating releases
stephenmathieson 1f12a85
Merge branch 'develop' into release-workflow
stephenmathieson 6bad8dc
testing
stephenmathieson 157ec66
all commits
stephenmathieson 2497826
push branch
stephenmathieson 5cf80bb
pat
stephenmathieson 645d85f
this repo still uses master
stephenmathieson f5b9f76
remove testing stuff
stephenmathieson d2bfa19
:robot: Automated formatting fixes
stephenmathieson b0788d7
Merge branch 'develop' into release-workflow
stephenmathieson cf6902d
Merge branch 'release-workflow' of ssh://github.com/dequelabs/axe-cor…
stephenmathieson 38058d9
Update .github/workflows/release.yml
stephenmathieson 8c0b2c6
Update .github/workflows/release.yml
stephenmathieson 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,51 @@ | ||
name: Create release candidate | ||
|
||
on: [workflow_dispatch] | ||
|
||
jobs: | ||
create_release: | ||
name: Create release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/cache@v3 | ||
with: | ||
path: ./node_modules | ||
key: npm-cache-${{ runner.os }}-${{ hashFiles('./package-lock.json') }} | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- name: Run release script and open PR | ||
run: | | ||
git config user.name "API Team CI User" | ||
git config user.email "[email protected]" | ||
|
||
Branch="release-$(date +%Y-%m-%d)" | ||
echo "Branch: $Branch" | ||
git checkout -b "$Branch" | ||
|
||
npm run release | ||
|
||
git push origin "$Branch" --force | ||
|
||
Version=$(jq -r .version ./package.json) | ||
echo "Version: $Version" | ||
|
||
# Get the additions to the changelog as the commit body and generate the PR url | ||
ReleaseNotes=$( | ||
git show \ | ||
--no-color \ | ||
--no-prefix \ | ||
--output-indicator-new=! CHANGELOG.md | egrep '^!' | awk -F'^[!]' '{print $2}' | sed -e 's/\n/$0A/g' | ||
) | ||
|
||
echo "chore(release): v$Version" > /tmp/pr.txt | ||
echo "" >> /tmp/pr.txt | ||
echo "$ReleaseNotes" >> /tmp/pr.txt | ||
echo "" >> /tmp/pr.txt | ||
echo "This PR was opened by a robot :robot: :tada:" >> /tmp/pr.txt | ||
hub pull-request --file /tmp/pr.txt --base master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PAT }} |
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.
Why the force push?
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.
If the branch already has changes in it, we'll want to overwrite them.
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.
Wouldn't the checkout action fail then and kill the build before it got to this point? Not that it's preventing the pr from going through, was just curious
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.
No, the checkout action is taking whatever branch we're releasing from (usually
develop
). We then create this branch, add the release commit, then push. The--force
is to ensure any prior pending release (maybe someone made a mistake) is overwritten.This is, however, fixing a problem we haven't had (yet?). I'm happy to pull it out if you aren't comfortable force pushing.
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.
Wilco didn't seem to think it was a problem when he reviewed it, so I'm fine with it.
edit: actually turns out wilcos review did not cover this line. let me confirm with him first before merging
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 don't see how it matters. If the branch already exists
checkout -b
will fail. I'm good with it as-is.