From d00773bb14e006fc51f70f95c5072308798ddc1d Mon Sep 17 00:00:00 2001 From: jimid27 Date: Wed, 4 Dec 2024 11:56:13 -0500 Subject: [PATCH 01/10] Initial commit --- .github/workflows/release.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..3a07e47 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,23 @@ +--- +name: Update Major Version of Prefect Deploy Action +on: + push: + tags: + # Match the version format to not catch vx major releases + - 'v*.*.*' +permissions: {} +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Release Major Version + run: | + export MAJOR_VERSION=$(echo ${{ github.ref_name }} | cut -d '.' -f 1) + echo "Releasing major version ${MAJOR_VERSION}" + if git show-ref --tags --verify --quiet "refs/tags/${MAJOR_VERSION}"; then + echo "Tag ${MAJOR_VERSION} exists, bumping to match with the latest release" + else + echo "Tag ${MAJOR_VERSION} does not exist. Creating a new tag and release." + gh release create --title "${MAJOR_VERSION}" --generate-notes --target "${MAJOR_VERSION} --latest" + fi From 289c6b002ccdbb0ae9abc3ea1af69314beefebed Mon Sep 17 00:00:00 2001 From: jimid27 Date: Wed, 4 Dec 2024 13:10:44 -0500 Subject: [PATCH 02/10] Use head --- .github/workflows/release.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3a07e47..b3c4852 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -19,5 +19,7 @@ jobs: echo "Tag ${MAJOR_VERSION} exists, bumping to match with the latest release" else echo "Tag ${MAJOR_VERSION} does not exist. Creating a new tag and release." + git tag "${MAJOR_VERSION}" + git push origin --tags gh release create --title "${MAJOR_VERSION}" --generate-notes --target "${MAJOR_VERSION} --latest" fi From cfc36b8bae662aae58d59e6c7a8eb96e3b18e5cd Mon Sep 17 00:00:00 2001 From: jimid27 Date: Wed, 4 Dec 2024 13:58:02 -0500 Subject: [PATCH 03/10] Automated update or releasing of major GHA versions --- .../workflows/{release.yaml => create-update-release.yaml} | 7 +++++-- README.md | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) rename .github/workflows/{release.yaml => create-update-release.yaml} (78%) diff --git a/.github/workflows/release.yaml b/.github/workflows/create-update-release.yaml similarity index 78% rename from .github/workflows/release.yaml rename to .github/workflows/create-update-release.yaml index b3c4852..9804a43 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/create-update-release.yaml @@ -17,9 +17,12 @@ jobs: echo "Releasing major version ${MAJOR_VERSION}" if git show-ref --tags --verify --quiet "refs/tags/${MAJOR_VERSION}"; then echo "Tag ${MAJOR_VERSION} exists, bumping to match with the latest release" + git tag ${MAJOR_VERSION} -f + git push origin ${MAJOR_VERSION} -f else echo "Tag ${MAJOR_VERSION} does not exist. Creating a new tag and release." + export RELEASE_SHA=$(git rev-parse HEAD) git tag "${MAJOR_VERSION}" - git push origin --tags - gh release create --title "${MAJOR_VERSION}" --generate-notes --target "${MAJOR_VERSION} --latest" + git push origin ${MAJOR_VERSION} + gh release create --title "${MAJOR_VERSION}" --generate-notes --target "${RELEASE_SHA} --latest" fi diff --git a/README.md b/README.md index 493df1a..bc36574 100644 --- a/README.md +++ b/README.md @@ -196,5 +196,8 @@ jobs: PREFECT_API_URL: ${{ secrets.PREFECT_API_URL }} ``` +## Releasing the Action +Manually create a new semver release (i.e `v1.0.0`) against a new tag to trigger the release workflow. This workflow will update the major version of the action (i.e `v1`) to point to the new semver release. + ## Terms & Conditions See here for the Prefect's [Terms and Conditions](https://www.prefect.io/legal/terms/). From c6aa630b0d3fe0c104bb0b641614c9f28211a753 Mon Sep 17 00:00:00 2001 From: jimid27 Date: Wed, 4 Dec 2024 14:06:44 -0500 Subject: [PATCH 04/10] Give perms --- .github/workflows/create-update-release.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/create-update-release.yaml b/.github/workflows/create-update-release.yaml index 9804a43..8686623 100644 --- a/.github/workflows/create-update-release.yaml +++ b/.github/workflows/create-update-release.yaml @@ -8,6 +8,8 @@ on: permissions: {} jobs: release: + permissions: + contents: write runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From 19649eb2fa54f86e21a0a4afe5c0e9235316b998 Mon Sep 17 00:00:00 2001 From: jimid27 Date: Wed, 4 Dec 2024 14:11:59 -0500 Subject: [PATCH 05/10] Fetch depth --- .github/workflows/create-update-release.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/create-update-release.yaml b/.github/workflows/create-update-release.yaml index 8686623..00683c8 100644 --- a/.github/workflows/create-update-release.yaml +++ b/.github/workflows/create-update-release.yaml @@ -13,6 +13,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Release Major Version run: | export MAJOR_VERSION=$(echo ${{ github.ref_name }} | cut -d '.' -f 1) From 31a230d43906197015a6bf37170ca0ef6824b746 Mon Sep 17 00:00:00 2001 From: jimid27 Date: Wed, 4 Dec 2024 14:13:59 -0500 Subject: [PATCH 06/10] GH Token --- .github/workflows/create-update-release.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create-update-release.yaml b/.github/workflows/create-update-release.yaml index 00683c8..01a0b1a 100644 --- a/.github/workflows/create-update-release.yaml +++ b/.github/workflows/create-update-release.yaml @@ -7,7 +7,7 @@ on: - 'v*.*.*' permissions: {} jobs: - release: + update-create-major-version: permissions: contents: write runs-on: ubuntu-latest @@ -30,3 +30,5 @@ jobs: git push origin ${MAJOR_VERSION} gh release create --title "${MAJOR_VERSION}" --generate-notes --target "${RELEASE_SHA} --latest" fi + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From ec9d48ea397f1f6b632db8c73a7581c958867ecb Mon Sep 17 00:00:00 2001 From: jimid27 Date: Wed, 4 Dec 2024 14:18:19 -0500 Subject: [PATCH 07/10] Typo --- .github/workflows/create-update-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-update-release.yaml b/.github/workflows/create-update-release.yaml index 01a0b1a..8ecc83e 100644 --- a/.github/workflows/create-update-release.yaml +++ b/.github/workflows/create-update-release.yaml @@ -28,7 +28,7 @@ jobs: export RELEASE_SHA=$(git rev-parse HEAD) git tag "${MAJOR_VERSION}" git push origin ${MAJOR_VERSION} - gh release create --title "${MAJOR_VERSION}" --generate-notes --target "${RELEASE_SHA} --latest" + gh release create --title "${MAJOR_VERSION}" --generate-notes --target "${RELEASE_SHA}" --latest fi env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 7c87e4c1eca90ecaa1307d60cdf1a7326bcff546 Mon Sep 17 00:00:00 2001 From: jimid27 Date: Wed, 4 Dec 2024 14:20:15 -0500 Subject: [PATCH 08/10] Needs tag --- .github/workflows/create-update-release.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/create-update-release.yaml b/.github/workflows/create-update-release.yaml index 8ecc83e..4fc4526 100644 --- a/.github/workflows/create-update-release.yaml +++ b/.github/workflows/create-update-release.yaml @@ -26,9 +26,7 @@ jobs: else echo "Tag ${MAJOR_VERSION} does not exist. Creating a new tag and release." export RELEASE_SHA=$(git rev-parse HEAD) - git tag "${MAJOR_VERSION}" - git push origin ${MAJOR_VERSION} - gh release create --title "${MAJOR_VERSION}" --generate-notes --target "${RELEASE_SHA}" --latest + gh release create "${MAJOR_VERSION}" --title "${MAJOR_VERSION}" --generate-notes --target "${RELEASE_SHA}" --latest fi env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 858aa19189290ea33055a762f8e035bb6428e7d7 Mon Sep 17 00:00:00 2001 From: jimid27 Date: Wed, 4 Dec 2024 14:24:32 -0500 Subject: [PATCH 09/10] Update name of step --- .github/workflows/create-update-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-update-release.yaml b/.github/workflows/create-update-release.yaml index 4fc4526..602c370 100644 --- a/.github/workflows/create-update-release.yaml +++ b/.github/workflows/create-update-release.yaml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Release Major Version + - name: Release or UpdateMajor Version run: | export MAJOR_VERSION=$(echo ${{ github.ref_name }} | cut -d '.' -f 1) echo "Releasing major version ${MAJOR_VERSION}" From 8974f91460f1ed9b0b59b6252fd2c9423b720be4 Mon Sep 17 00:00:00 2001 From: Jimi Dodd-o Date: Wed, 4 Dec 2024 14:45:45 -0500 Subject: [PATCH 10/10] Update .github/workflows/create-update-release.yaml Co-authored-by: Mitchell Nielsen --- .github/workflows/create-update-release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-update-release.yaml b/.github/workflows/create-update-release.yaml index 602c370..d60265d 100644 --- a/.github/workflows/create-update-release.yaml +++ b/.github/workflows/create-update-release.yaml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Release or UpdateMajor Version + - name: Release or Update Major Version run: | export MAJOR_VERSION=$(echo ${{ github.ref_name }} | cut -d '.' -f 1) echo "Releasing major version ${MAJOR_VERSION}"