-
-
Notifications
You must be signed in to change notification settings - Fork 17
44 lines (36 loc) · 1.07 KB
/
update-version-txt.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
name: Update version text file
on:
workflow_dispatch:
release:
types:
- published
jobs:
replace-txt:
runs-on: ubuntu-latest
env:
RELEASE_VERSION: ${{ github.event.release.tag_name }}
steps:
- name: Checkout the latest version of main
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Checkout the main branch explicitly
run: |
git checkout main
git pull origin main --rebase # Ensure you're up to date with the remote
- name: Replace contents of version.txt
run: |
RAW_VERSION=${{ env.RELEASE_VERSION }}
CLEAN_VERSION="${RAW_VERSION#v}"
echo "$CLEAN_VERSION" > version.txt
- name: Commit changes
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add version.txt
git commit -m "Version tag update (GitHub actions)"
- name: Push changes
run: |
git push origin main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}