Skip to content
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

Fix release action #25

Merged
merged 1 commit into from
Nov 29, 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
16 changes: 12 additions & 4 deletions .github/workflows/release-on-version-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
fetch-depth: 0 # Fetch all history

- name: Get previous commit hash
id: prev_commit
Expand Down Expand Up @@ -51,19 +51,27 @@ jobs:
VERSION: ${{ env.VERSION }}
PREV_VERSION: ${{ env.PREV_VERSION }}
run: |
if [ "$VERSION" != "$PREV_VERSION" ] && [[ "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
# Remove leading 'v' if present
VERSION_STRIPPED=${VERSION#v}
PREV_VERSION_STRIPPED=${PREV_VERSION#v}

# Check if versions are different and match the format
if [ "$VERSION_STRIPPED" != "$PREV_VERSION_STRIPPED" ] && [[ "$VERSION_STRIPPED" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Version has changed from $PREV_VERSION to $VERSION"
echo "version_changed=true" >> $GITHUB_OUTPUT
else
echo "Version has not changed or does not match the format v*.*.*"
echo "Version has not changed or does not match the format *.*.*"
echo "version_changed=false" >> $GITHUB_OUTPUT
fi

# Output VERSION_STRIPPED to GITHUB_ENV
echo "VERSION_STRIPPED=$VERSION_STRIPPED" >> $GITHUB_ENV

- name: Create Release
if: steps.version_compare.outputs.version_changed == 'true'
uses: ncipollo/release-action@v1
with:
tag: ${{ env.VERSION }}
tag: v${{ env.VERSION_STRIPPED }}
name: ${{ github.event.pull_request.title }}
body: ${{ github.event.pull_request.body }}
draft: false
Expand Down