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

Chore/add automated release or update of major GHA version #60

Merged
merged 10 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from 9 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
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Means we don't want to run this action when a major version (i.e v5) is tagged and released

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the else statement doing then if not running on a major release?

- '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 UpdateMajor Version
jimid27 marked this conversation as resolved.
Show resolved Hide resolved
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 }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be ref'd by $GITHUB_TOKEN but i could be wrong

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/elgohr/Github-Release-Action?tab=readme-ov-file#github-release-action I was going off of this referenced by the github actions docs and I think it works since I tested a major bump in my own repo but if theres a better way I'm def down to change!

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/).
Loading