Skip to content

Commit 2a0a4db

Browse files
create tag GHA
1 parent 7f383ac commit 2a0a4db

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Create Version Tag
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
paths:
7+
- 'lerna.json'
8+
9+
concurrency:
10+
group: "version-tag"
11+
cancel-in-progress: false
12+
13+
jobs:
14+
create-tag:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v6
21+
with:
22+
fetch-depth: 2
23+
token: ${{ secrets.GITHUB_TOKEN }}
24+
25+
- name: Check if version changed
26+
id: check_version
27+
run: |
28+
if git diff HEAD^ lerna.json | grep -q '^+.*"version":'; then
29+
echo "version_changed=true" >> $GITHUB_OUTPUT
30+
fi
31+
32+
- name: Create and push tag
33+
if: steps.check_version.outputs.version_changed == 'true'
34+
run: |
35+
VERSION=$(grep '"version":' lerna.json | sed 's/.*"version": "\([^"]*\)".*/\1/')
36+
TAG_NAME="v$VERSION"
37+
38+
git config --global user.name "${{ github.actor }}"
39+
git config --global user.email "${{ github.actor }}@users.noreply.github.com"

0 commit comments

Comments
 (0)