Skip to content

Commit b52f2da

Browse files
committed
try #6
1 parent fedf886 commit b52f2da

1 file changed

Lines changed: 33 additions & 6 deletions

File tree

.github/workflows/release.yaml

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,57 @@ on:
66
- main
77

88
jobs:
9-
build:
9+
build-and-release:
1010
runs-on: macos-latest
1111

1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v3
14+
with:
15+
fetch-depth: 0
1416

17+
# Rust Toolchain
1518
- uses: actions-rs/toolchain@v1
1619
with:
1720
toolchain: stable
1821
override: true
1922
profile: minimal
2023

24+
# Determine next version tag
25+
- name: Get next version
26+
id: version
27+
run: |
28+
latest_tag=$(git tag --sort=-v:refname | head -n1)
29+
if [ -z "$latest_tag" ]; then
30+
next_tag="v1.0.0"
31+
else
32+
IFS='.' read -r major minor patch <<<"${latest_tag#v}"
33+
patch=$((patch + 1))
34+
next_tag="v${major}.${minor}.${patch}"
35+
fi
36+
echo "Next tag: $next_tag"
37+
echo "next_tag=$next_tag" >> $GITHUB_ENV
38+
39+
# Create Git tag
40+
- name: Create Git tag
41+
run: |
42+
git config user.name "github-actions"
43+
git config user.email "github-actions@github.com"
44+
git tag ${{ env.next_tag }}
45+
git push origin ${{ env.next_tag }}
46+
47+
# Build release
2148
- name: Build release
22-
working-directory: ./rusty-clock
2349
run: cargo build --release
2450

25-
- name: Create Github Release
26-
id: create_release
51+
# Create GitHub Release
52+
- name: Create GitHub Release
2753
uses: softprops/action-gh-release@v1
2854
with:
29-
tag_name: v1.0.0
55+
tag_name: ${{ env.next_tag }}
3056
env:
3157
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
3258

59+
# Upload binary
3360
- name: Upload binary
3461
uses: softprops/action-gh-release@v1
3562
with:

0 commit comments

Comments
 (0)