-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add a dedicated version bump workflow
- Loading branch information
Showing
1 changed file
with
73 additions
and
0 deletions.
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,73 @@ | ||
#--------------------------------------------------------- | ||
# - Create a semantical release | ||
# - Set latest tag | ||
#--------------------------------------------------------- | ||
name: Bump version | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- next | ||
- next-major | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# required antecedent | ||
- uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
|
||
- name: Setup Node.js environment | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.9.0' | ||
|
||
- name: Install npm dev dependencies | ||
run: npm install --only=dev | ||
|
||
- name: Get current version | ||
id: current_version | ||
run: | | ||
echo "::set-output name=version::$(python -c 'from __version__ import __version__; print(__version__)')" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PAT }} | ||
|
||
- name: Get next version | ||
id: next_version | ||
run: | | ||
echo "::set-output name=version::$(npx semantic-release --dry-run | awk '/The next release version is/{print $NF}')" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PAT }} | ||
|
||
- name: Debug current version | ||
id: debug_current_version | ||
run: echo "Current version is '${{ steps.current_version.outputs.version }}'" | ||
|
||
- name: Debug next version | ||
id: debug_next_version | ||
run: echo "Next version is '$(npx semantic-release --dry-run | awk '/The next release version is/{print $NF}')'" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PAT }} | ||
|
||
- name: Debug next version output | ||
id: debug_next_version_output | ||
run: echo "Next version is '${{ steps.next_version.outputs.version }}'" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PAT }} | ||
|
||
- name: Update __version__ | ||
if: steps.current_version.outputs.version != steps.next_version.outputs.version | ||
id: update_version | ||
run: | | ||
echo "__version__ = '${{ steps.next_version.outputs.version }}'" > __version__.py | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git add __version__.py | ||
git commit -m "chore: [gh] Update __version__.py to ${{ steps.next_version.outputs.version }} [skip ci]" | ||
git push https://${{ secrets.PAT }}@github.com/${{ github.repository }}.git HEAD:main | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PAT }} |