diff --git a/.github/workflows/create-update-release.yaml b/.github/workflows/create-update-release.yaml new file mode 100644 index 0000000..d60265d --- /dev/null +++ b/.github/workflows/create-update-release.yaml @@ -0,0 +1,32 @@ +--- +name: Update Major Version of Prefect Deploy Action +on: + push: + tags: + # Match the version format to not catch vx major releases + - 'v*.*.*' +permissions: {} +jobs: + update-create-major-version: + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Release or Update 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" + 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) + gh release create "${MAJOR_VERSION}" --title "${MAJOR_VERSION}" --generate-notes --target "${RELEASE_SHA}" --latest + fi + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 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/).