Skip to content

Commit

Permalink
remove snap
Browse files Browse the repository at this point in the history
  • Loading branch information
darioAnongba committed Dec 17, 2024
1 parent e60464a commit 3bab48e
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 4 deletions.
44 changes: 44 additions & 0 deletions .github/actions/check-is-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Check if Release

on:
workflow_call:
inputs:
base_ref:
description: "The base branch or commit for comparison"
required: true
type: string
outputs:
IS_RELEASE:
description: "True if Cargo.toml version has been updated"
value: ${{ steps.check-release.outputs.is_release }}

jobs:
check-is-release:
name: Check Cargo.toml for Version Bump
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- 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/"//')
echo "Current version: $current_version"
echo "Previous version: $previous_version"
if [ "$current_version" != "$previous_version" ]; then
echo "Version bump detected."
echo "is_release=true" >> "$GITHUB_OUTPUT"
else
echo "No version bump detected."
echo "is_release=false" >> "$GITHUB_OUTPUT"
fi
outputs:
is_release: ${{ steps.check-release.outputs.is_release }}
12 changes: 8 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,14 @@ jobs:
is-release:
needs: all-jobs-pass
name: Check if release
uses: ./.github/workflows/check-is-release.yml
with:
base_ref: main
runs-on: ubuntu-latest
outputs:
IS_RELEASE: ${{ steps.is-release.outputs.IS_RELEASE }}
steps:
- name: Check if Cargo.toml version was upgraded
uses: ./.github/actions/check-is-release.yml
with:
base_ref: main

publish-release:
needs: is-release
Expand Down

0 comments on commit 3bab48e

Please sign in to comment.