Skip to content

feat: new auto-release #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/autorelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Tag New Release
on:
push:
branches:
- main
paths:
- 'Cargo.toml'

permissions:
contents: write
id-token: write

jobs:
verify-new-release-needed:
name: Verify new release needed
runs-on: ubuntu-latest
environment: dev
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Verify new release needed
run: |
echo "Checking if a new release is needed"
# get current version from cargo
CARGO_VER="v$(cargo metadata --format-version=1 --no-deps | jq '.packages[] | select(.name == "signet-node") | .version' -r)"
echo "$CARGO_VER"
# get latest version from git tags
GIT_VER=$(git describe --tags --abbrev=0)
echo "$GIT_VER"
if [ "$CARGO_VER" == "$GIT_VER" ]; then
echo "# No new release needed" >> $GITHUB_STEP_SUMMARY
exit 0
else
echo "New release needed"
gh release create "$CARGO_VER" -t "$CARGO_VER" --generate-notes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are the quotes actually needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed no, theoretically safer? maybe. At worst it doesn't hurt at best it makes sure whatevers in there is (mostly) a string

## Add the release information to the github actions summary
echo "# New Release Created" >> $GITHUB_STEP_SUMMARY
echo "Tag: $CARGO_VER" >> $GITHUB_STEP_SUMMARY
fi