Skip to content

Commit 816fb1f

Browse files
committed
Added auto tag file
1 parent ecafc53 commit 816fb1f

3 files changed

Lines changed: 50 additions & 2 deletions

File tree

.github/workflows/auto-tag.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Auto Tag on Version Change
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'jup-ag-sdk/Cargo.toml'
9+
10+
# Add permissions section
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
auto-tag:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v3
19+
with:
20+
fetch-depth: 0
21+
token: ${{ secrets.GITHUB_TOKEN }} # Use the default token with write permissions
22+
23+
- name: Get version from Cargo.toml
24+
id: get_version
25+
run: |
26+
VERSION=$(grep -m 1 "version" jup-ag-sdk/Cargo.toml | sed 's/.*= "//' | sed 's/".*//')
27+
echo "version=$VERSION" >> $GITHUB_OUTPUT
28+
echo "Found version: $VERSION"
29+
30+
- name: Check if tag exists
31+
id: check_tag
32+
run: |
33+
if git tag -l "v${{ steps.get_version.outputs.version }}" | grep -q "v${{ steps.get_version.outputs.version }}"; then
34+
echo "Tag already exists"
35+
echo "exists=true" >> $GITHUB_OUTPUT
36+
else
37+
echo "Tag does not exist"
38+
echo "exists=false" >> $GITHUB_OUTPUT
39+
fi
40+
41+
- name: Create and push tag
42+
if: steps.check_tag.outputs.exists == 'false'
43+
run: |
44+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
45+
git config --local user.name "github-actions[bot]"
46+
git tag -a v${{ steps.get_version.outputs.version }} -m "Release version ${{ steps.get_version.outputs.version }}"
47+
git push origin v${{ steps.get_version.outputs.version }}
48+
echo "Created and pushed tag v${{ steps.get_version.outputs.version }}"

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jup-ag-sdk/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "jup-ag-sdk"
3-
version = "1.0.1"
3+
version = "1.0.2"
44
edition = "2024"
55
license-file = "../LICENSE"
66
readme = "../README.md"

0 commit comments

Comments
 (0)