Skip to content

Commit

Permalink
Merge pull request #2 from gnosis/check-changes-before-release
Browse files Browse the repository at this point in the history
Release only if changes exist
  • Loading branch information
squadgazzz authored Feb 7, 2024
2 parents f152d67 + 7114c8e commit 44ab49b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,25 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: main
fetch-depth: 0 # Fetch all history for all branches and tags
# Requires "Read and Write access to code" permission
token: ${{ secrets.RELEASE_ACTION_ACCESS_TOKEN }}

- name: Check for changes since last tag
id: check_changes
run: |
LATEST_TAG=$(git tag --merged=main --sort=-committerdate | head -n 1)
CHANGES=$(git log $LATEST_TAG..HEAD --oneline)
if [[ -z "$CHANGES" ]]; then
echo "No changes since the last tag."
else
echo "Changes detected since the last tag."
echo "has_changes=true" >> $GITHUB_OUTPUT
fi
- name: Create Tag
if: ${{ steps.check_changes.outputs.has_changes }}
id: tag_version
run: |
# Extracts the latest version tag, bumps the minor version
Expand All @@ -35,6 +49,7 @@ jobs:
git push origin --tags
- name: "Create release"
if: ${{ steps.check_changes.outputs.has_changes }}
uses: "actions/github-script@v6"
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
Expand Down

0 comments on commit 44ab49b

Please sign in to comment.