Skip to content

Commit 2245ce6

Browse files
committed
feat(ci): add bump action
1 parent 82ebcad commit 2245ce6

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

.github/workflows/bump.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
6+
jobs:
7+
bump:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: write
11+
actions: write
12+
steps:
13+
- uses: actions/checkout@v5
14+
with:
15+
fetch-depth: 0
16+
fetch-tags: true
17+
- name: Set up git config
18+
run: |
19+
git config --global user.name "github-actions[bot]"
20+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
21+
- uses: actions/setup-cz@main
22+
- id: bump-version
23+
run: |
24+
cz bump --yes
25+
current_version="v$(cz version -p --current)"
26+
major_version="v$(cz version -p --major)"
27+
echo "current_version=$current_version" >> $GITHUB_OUTPUT
28+
echo "major_version=$major_version" >> $GITHUB_OUTPUT
29+
- name: Update major tag
30+
env:
31+
CURRENT_VERSION: ${{ steps.bump-version.outputs.current_version }}
32+
MAJOR_VERSION: ${{ steps.bump-version.outputs.major_version }}
33+
run: |
34+
# Push new commit + new tag
35+
git push --follow-tags
36+
37+
# Move major tag to the latest commit
38+
git tag -fa "${MAJOR_VERSION}" -m "release ${CURRENT_VERSION}"
39+
40+
# Force push new major tag
41+
git push origin "${MAJOR_VERSION}" -f
42+
- name: Build changelog
43+
env:
44+
CURRENT_VERSION: ${{ steps.bump-version.outputs.current_version }}
45+
run: |
46+
cz changelog --dry-run "${CURRENT_VERSION}" > .changelog.md
47+
- name: Release
48+
uses: softprops/action-gh-release@v2
49+
with:
50+
body_path: ".changelog.md"
51+
tag_name: ${{ steps.bump-version.outputs.current_version }}
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)