-
Notifications
You must be signed in to change notification settings - Fork 3
ci: github release action #242
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
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
989ccf5
ci: rename pypi release action
DaniBodor c2e2563
ci: github release action
DaniBodor f282a80
ci: create separate job to update develop
DaniBodor 7e4a216
ci: close associated PRs
DaniBodor bc49d27
ci: use bump-my-version instead of bumpversion
DaniBodor 1596c73
docs: update docs for releasing
DaniBodor 30690dc
docs: remove outdated info from dev readme
DaniBodor fb7d267
style: delete obsolete files
DaniBodor 06083aa
ci: streamline github release commands
DaniBodor c40beb2
docs: add branching strategy to dev readme
DaniBodor 2ea4890
docs: clarify releasing instructions
DaniBodor bdd1876
style: fix linting after ruff 0.5.0 update
DaniBodor 6970d96
docs: refer back to branching strategy in manual release guide
DaniBodor 60950fa
ci: streamline merging in github release workflow
DaniBodor e129bd3
Update README.dev.md
DaniBodor 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,117 @@ | ||
| name: Draft GitHub Release | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| version_level: | ||
| description: "Semantic version level increase." | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - patch | ||
| - minor | ||
| - major | ||
| release_branch: | ||
| description: "Branch to use for releasing." | ||
| type: string | ||
| default: "test_protected_develop" | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| github_release: | ||
| runs-on: "ubuntu-latest" | ||
| defaults: | ||
| run: | ||
| shell: bash -l {0} | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| token: ${{ secrets.GH_PAT }} | ||
|
|
||
| - name: Configure git | ||
| run: | | ||
| git config user.email "actions@github.com" | ||
| git config user.name "GitHub Actions" | ||
| git pull | ||
|
|
||
| - name: Merge changes into main | ||
| run: | | ||
| git switch test_protected_main | ||
| git merge ${{ github.event.inputs.release_branch }} --no-ff --no-commit | ||
| git merge --continue | ||
|
|
||
| - name: Bump version | ||
| id: bump | ||
| run: | | ||
| echo "-- install bump-my-version" | ||
| python3 -m pip install bump-my-version | ||
| echo "-- bump the version" | ||
| bump-my-version bump ${{ github.event.inputs.version_level }} --commit --tag | ||
| echo "-- push bumped version" | ||
| echo "RELEASE_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT | ||
| git push --tags -f | ||
| git push | ||
|
|
||
| - name: Create GitHub Release | ||
| id: create_release | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| gh release create ${{ steps.bump.outputs.RELEASE_TAG }} \ | ||
| --title="Release ${{ steps.bump.outputs.RELEASE_TAG }}" \ | ||
| --generate-notes \ | ||
| --draft | ||
|
|
||
| tidy_workspace: | ||
| # only run if action above succeeds | ||
| needs: github_release | ||
| runs-on: "ubuntu-latest" | ||
| defaults: | ||
| run: | ||
| shell: bash -l {0} | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| token: ${{ secrets.GH_PAT }} | ||
|
|
||
| - name: Configure git | ||
| run: | | ||
| git config user.email "actions@github.com" | ||
| git config user.name "GitHub Actions" | ||
| git pull | ||
|
|
||
| - name: Close PR | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| echo "-- searching for associated PR" | ||
| branch_name=${{ github.event.inputs.release_branch }} | ||
| pr_number=$(gh pr list --head $branch_name --json number --jq '.[0].number') | ||
| if [ -n "$pr_number" ]; then | ||
| echo "-- closing PR #$pr_number" | ||
| gh pr close $pr_number | ||
| else | ||
| echo "-- no open pull request found for branch $branch_name" | ||
| fi | ||
|
|
||
| - name: Merge updates into develop | ||
| run: | | ||
| git switch test_protected_develop | ||
| git merge origin/test_protected_main | ||
| git push | ||
|
|
||
| - name: Delete release branch other than main or develop | ||
| run: | | ||
| if [[ ${{ github.event.inputs.release_branch}} != "test_protected_main" && ${{ github.event.inputs.release_branch}} != "test_protected_develop" ]]; then | ||
| echo "-- deleting branch '${{ github.event.inputs.release_branch }}'" | ||
| git push origin -d ${{ github.event.inputs.release_branch }} | ||
| else | ||
| echo "-- branch '${{ github.event.inputs.release_branch}}' will not be deleted from remote" | ||
| fi | ||
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.