Skip to content

Commit 5e9eae6

Browse files
committed
feat: add workflow
Signed-off-by: Bartosz Czyż <czyzbartosz3@gmail.com>
1 parent 9360076 commit 5e9eae6

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
on:
2+
push:
3+
branches:
4+
- v3-cli-test-workflow
5+
permissions:
6+
contents: write
7+
jobs:
8+
cli-tag-version:
9+
runs-on: ubuntu-24.04
10+
steps:
11+
- uses: actions/checkout@v5
12+
name: Checkout code
13+
with:
14+
fetch-depth: 0
15+
- name: Get version from cli's build.gradle
16+
id: get_version
17+
run: |
18+
version=$(grep "^version" here-naksha-cli/build.gradle.kts | tail -1 | cut -d = -f 2 | xargs)
19+
echo "Detected version: $version"
20+
echo "version=$version" >> "$GITHUB_OUTPUT"
21+
- name: Check if tag exists
22+
id: check_tag
23+
run: |
24+
tag="test-cli-v${{ steps.get_version.outputs.version }}"
25+
echo "tag=$tag" >> "$GITHUB_OUTPUT"
26+
echo "Checking for tag: $tag"
27+
if git rev-parse "$tag" >/dev/null 2>&1; then
28+
echo "Tag already exists"
29+
echo "exists=true" >> "$GITHUB_OUTPUT"
30+
else
31+
echo "Tag does not exist"
32+
echo "exists=false" >> "$GITHUB_OUTPUT"
33+
fi
34+
- name: Create Git tag
35+
if: steps.check_tag.outputs.exists == 'false'
36+
run: |
37+
tag=${{ steps.check_tag.outputs.tag }}
38+
git config user.name "github-actions[bot]"
39+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
40+
git tag "$tag"
41+
git push --tags origin "$tag"

0 commit comments

Comments
 (0)