Skip to content

Commit e94d159

Browse files
authored
feat: use shared autorelease workflow (#17)
### TL;DR Simplified the auto-release workflow by utilizing a reusable workflow from init4tech/actions. ### What changed? Replaced the custom release verification and creation logic with a standardized reusable workflow. The new workflow maintains the same trigger conditions (pushing to main branch with changes to Cargo.toml) while reducing complexity. ### How to test? 1. Update the version in Cargo.toml 2. Push changes to the main branch 3. Verify that a new release is automatically created with the updated version
1 parent a24432a commit e94d159

File tree

1 file changed

+14
-41
lines changed

1 file changed

+14
-41
lines changed

.github/workflows/autorelease.yml

+14-41
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,17 @@
1-
name: Tag New Release
1+
name: Create Rust Release
2+
23
on:
3-
push:
4-
branches:
5-
- main
6-
paths:
7-
- 'Cargo.toml'
8-
9-
permissions:
10-
contents: write
11-
id-token: write
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'Cargo.toml'
9+
10+
permissions: # these permissions are required for the actions to run
11+
contents: write
1212

1313
jobs:
14-
verify-new-release-needed:
15-
name: Verify new release needed
16-
runs-on: ubuntu-latest
17-
environment: dev
18-
steps:
19-
- name: Checkout code
20-
uses: actions/checkout@v4
21-
with:
22-
fetch-tags: "true"
23-
fetch-depth: "0"
24-
- name: Verify new release needed
25-
env:
26-
GH_TOKEN: ${{ github.token }}
27-
run: |
28-
echo "Checking if a new release is needed"
29-
# get current version from cargo
30-
CARGO_VER="v$(cargo metadata --format-version=1 --no-deps | jq '.packages[] | select(.name == "zenith-builder-example") | .version' -r)"
31-
echo "$CARGO_VER"
32-
# get latest version from git tags
33-
GIT_VER=$(git describe --tags $(git rev-list --tags --max-count=1))
34-
echo "$GIT_VER"
35-
if [ "$CARGO_VER" == "$GIT_VER" ]; then
36-
echo "# No new release needed" >> $GITHUB_STEP_SUMMARY
37-
exit 0
38-
else
39-
echo "New release needed"
40-
gh release create "$CARGO_VER" -t "$CARGO_VER" --generate-notes
41-
## Add the release information to the github actions summary
42-
echo "# New Release Created" >> $GITHUB_STEP_SUMMARY
43-
echo "Tag: $CARGO_VER" >> $GITHUB_STEP_SUMMARY
44-
fi
14+
auto-release:
15+
uses: init4tech/actions/.github/workflows/auto-release-rust.yml@main
16+
with:
17+
binary-name: 'zenith-builder-example'

0 commit comments

Comments
 (0)