Skip to content

Commit

Permalink
Chore/add automated release or update of major GHA version (#60)
Browse files Browse the repository at this point in the history
* Initial commit

* Use head

* Automated update or releasing of major GHA versions

* Give perms

* Fetch depth

* GH Token

* Typo

* Needs tag

* Update name of step

* Update .github/workflows/create-update-release.yaml

Co-authored-by: Mitchell Nielsen <mitchnielsen@users.noreply.github.com>

---------

Co-authored-by: Mitchell Nielsen <mitchnielsen@users.noreply.github.com>
  • Loading branch information
jimid27 and mitchnielsen authored Dec 4, 2024
1 parent 21e36b7 commit 1e88db2
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/create-update-release.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/).

0 comments on commit 1e88db2

Please sign in to comment.