From c577636229ca1501b498529486f2a0df42ef06a5 Mon Sep 17 00:00:00 2001 From: ilya Date: Wed, 31 Jan 2024 17:11:01 +0000 Subject: [PATCH 1/6] Release only if changes persist --- .github/workflows/release.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4665430..62137ce 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,6 +2,7 @@ name: Weekly Release on: workflow_dispatch: + pull_request: schedule: # At 00:00 on Monday - cron: "0 0 * * 1" @@ -17,7 +18,20 @@ jobs: # 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 --sort=-authordate --merged=main | head --lines 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 From f05a809e93af93932a4ad4cb436ade7d8411625f Mon Sep 17 00:00:00 2001 From: ilya Date: Wed, 31 Jan 2024 17:19:34 +0000 Subject: [PATCH 2/6] Add condition to the release step --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 62137ce..febc50f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -49,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 }}" From 9d40c53295ff5b15687f67bfb287186e38091c00 Mon Sep 17 00:00:00 2001 From: ilya Date: Thu, 1 Feb 2024 17:13:50 +0000 Subject: [PATCH 3/6] Remove temp trigger --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index febc50f..fa9a55d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,6 @@ name: Weekly Release on: workflow_dispatch: - pull_request: schedule: # At 00:00 on Monday - cron: "0 0 * * 1" From bf3345eff2459d7d05031f157153486e98263b3c Mon Sep 17 00:00:00 2001 From: ilya Date: Tue, 6 Feb 2024 13:44:15 +0000 Subject: [PATCH 4/6] Specify main branch --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fa9a55d..5286d2f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,6 +13,7 @@ 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 }} From efa7afc764da5789dc9f11b00faebc6f93b918cf Mon Sep 17 00:00:00 2001 From: ilya Date: Tue, 6 Feb 2024 13:47:46 +0000 Subject: [PATCH 5/6] Sort by committerdate --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5286d2f..f1a9fa6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,6 +2,7 @@ name: Weekly Release on: workflow_dispatch: + pull_request: schedule: # At 00:00 on Monday - cron: "0 0 * * 1" @@ -21,7 +22,7 @@ jobs: - name: Check for changes since last tag id: check_changes run: | - LATEST_TAG=$(git tag --sort=-authordate --merged=main | head --lines 1) + 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." From 7114c8ed9cd03c4ad8dca9f3d94a8a02c8feb999 Mon Sep 17 00:00:00 2001 From: ilya Date: Tue, 6 Feb 2024 13:49:06 +0000 Subject: [PATCH 6/6] Remove pull-request trigger --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f1a9fa6..04f25a8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,6 @@ name: Weekly Release on: workflow_dispatch: - pull_request: schedule: # At 00:00 on Monday - cron: "0 0 * * 1"