-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (42 loc) · 1.25 KB
/
ci.yaml
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
48
name: CI
on:
push:
branches:
- master
jobs:
update-tag:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Configure Git
run: |
git config user.name "Pratikkumar Mohite"
git config user.email "mohite770.pm@gmail.com"
- name: Update the latest tag
id: update_latest_tag
run: |
git fetch --tags
latest_tag="$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1)"
if [ -z "$latest_tag" ]; then
latest_tag="v0.0.1"
echo "new_tag=$latest_tag" >> $GITHUB_OUTPUT
else
echo $latest_tag
IFS='.' read -ra version_parts <<< "$latest_tag"
major=${version_parts[0]}
minor=${version_parts[1]}
patch=${version_parts[2]}
new_patch=$((patch + 1))
new_tag="$major.$minor.$new_patch"
echo "new_tag=$new_tag" >> $GITHUB_OUTPUT
fi
- name: Create and push new tag
run: |
new_tag=${{ steps.update_latest_tag.outputs.new_tag }}
git tag -a $new_tag -m "Release $new_tag"
git push origin $new_tag