-
Notifications
You must be signed in to change notification settings - Fork 28
48 lines (41 loc) · 1.48 KB
/
update-version.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Update Version
on:
push:
branches:
- main
jobs:
version:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }}
- name: Get previous version
id: previous_version
run: |
VERSION=$(grep "buster=" version.txt | cut -d'=' -f2)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Conventional Commit Check and Version Bump
id: version_bump
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }}
default_bump: false
dry_run: true
tag_prefix: ""
- name: Update version.txt
if: steps.version_bump.outputs.new_version != steps.previous_version.outputs.version
run: |
NEW_VERSION="${{ steps.version_bump.outputs.new_version }}"
sed -i "s/buster=.*/buster=$NEW_VERSION/" version.txt
- name: Commit and push if changed
if: steps.version_bump.outputs.new_version != steps.previous_version.outputs.version
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add version.txt
git commit -m "chore: bump version to ${{ steps.version_bump.outputs.new_version }}"
git push