Skip to content

Commit 15ff207

Browse files
Create vTagBot.yml
1 parent 369342d commit 15ff207

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

.github/workflows/vTagBot.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: "vTagBot"
2+
3+
on:
4+
release:
5+
types: [released, edited]
6+
7+
jobs:
8+
sync-version:
9+
runs-on: ubuntu-latest
10+
11+
permissions:
12+
contents: write
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Extract release tag
19+
run: echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
20+
21+
- name: Update package.json version
22+
run: |
23+
TAG="${RELEASE_TAG#v}" # remove leading "v"
24+
echo "Updating version to $TAG"
25+
jq ".version = \"$TAG\"" package.json > package.tmp.json
26+
mv package.tmp.json package.json
27+
28+
- name: Commit and push changes
29+
run: |
30+
git config user.name "vTagBot"
31+
git config user.email "actions@github.com"
32+
git add package.json
33+
git commit -m "chore: sync version to $RELEASE_TAG" || echo "No changes to commit"
34+
git push

0 commit comments

Comments
 (0)