Skip to content

Commit

Permalink
update check release script
Browse files Browse the repository at this point in the history
  • Loading branch information
darioAnongba committed Jan 21, 2025
1 parent c8c1811 commit 0a40978
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/check-is-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ jobs:
- name: Compare Cargo.toml versions
id: check-release
run: |
# Extract the version from the current Cargo.toml
current_version=$(grep '^version' Cargo.toml | sed 's/version = "//' | sed 's/"//')
# Extract the version from the previous commit's Cargo.toml
git fetch origin ${{ inputs.base_ref }}
previous_version=$(git show origin/${{ inputs.base_ref }}:Cargo.toml | grep '^version' | sed 's/version = "//' | sed 's/"//')
# Find the merge base between the current branch and the base branch
merge_base=$(git merge-base HEAD origin/${{ inputs.base_ref }})
echo "Merge base commit: $merge_base"
current_version=$(grep -E '^version\s*=' Cargo.toml | sed -E 's/version\s*=\s*"([^"]+)"/\1/')
previous_version=$(git show $merge_base:Cargo.toml | grep -E '^version\s*=' | sed -E 's/version\s*=\s*"([^"]+)"/\1/')
echo "Current version: $current_version"
echo "Previous version: $previous_version"
Expand Down
12 changes: 1 addition & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Main

on:
push:
branches: [main]
branches: [main, release/v0.1.2]
pull_request:

jobs:
Expand Down Expand Up @@ -49,17 +49,7 @@ jobs:
exit 1
fi
is-release:
needs: all-jobs-pass
if: github.event_name == 'push'
name: Check if release
uses: ./.github/workflows/check-is-release.yml
with:
base_ref: main

publish-release:
needs: is-release
if: needs.is-release.outputs.IS_RELEASE == 'true'
name: Publish release
permissions:
contents: write
Expand Down

0 comments on commit 0a40978

Please sign in to comment.