-
Notifications
You must be signed in to change notification settings - Fork 55
31 lines (31 loc) · 981 Bytes
/
autotag.yml
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
name: autotag
#
# Create a git tag based on the Cargo workflow packages version if one does not already exist
# The tag will trigger the release process (as it is triggered via tagging)
#
on:
push:
branches: [main]
jobs:
create_tag:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create tag if changed
if: github.repository_owner == 'thin-edge'
run: |
VERISON=$(yq '.workspace.package.version' Cargo.toml)
if [ -z "$VERISON" ]; then
echo "Could not detect workspace package version (.workspace.package.version) from Cargo.toml"
exit 1
fi
if [ -n $(git tag -l "$VERSION") ]; then
echo "Skipping as tag already exists"
exit 0
fi
echo "Creating tag: $VERSION"
git tag -a "$VERSION" -m "Release $VERSION"
git push origin "$VERSION"