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

Release only if changes exist #2

Merged
merged 6 commits into from
Feb 7, 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
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
Loading