-
Notifications
You must be signed in to change notification settings - Fork 33
37 lines (32 loc) · 1010 Bytes
/
create-version-tag.yml
File metadata and controls
37 lines (32 loc) · 1010 Bytes
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
name: Create Version Tag
on:
push:
branches:
- master
paths:
- lerna.json
jobs:
create-tag:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 2
- name: Check if version changed
id: check_version
run: |
if git diff HEAD^ lerna.json | grep '+ "version": "'; then
echo "version_changed=true" >> $GITHUB_OUTPUT
fi
- name: Create and push tag
if: steps.check_version.outputs.version_changed == 'true'
run: |
VERSION=$(grep '^ "version":' lerna.json | sed 's/.*"version": "\([^"]*\)".*/\1/')
TAG_NAME="v$VERSION"
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git tag -a "$TAG_NAME" -m "Release $TAG_NAME"
git push origin "$TAG_NAME"