-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
/* PR_START p--release-setup 02 */ Add Github Action workflow to crea…
…te a release PR.
- Loading branch information
Showing
1 changed file
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
name: Create Release PR | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
bump: | ||
type: choice | ||
description: The version bump type. | ||
default: minor | ||
options: | ||
- major | ||
- minor | ||
- patch | ||
|
||
jobs: | ||
create-release-pr: | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: "RELEASE_CREATION" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: ./.github/actions/setup-python-env | ||
|
||
- name: Use Changie to Generate Change Log for the New Release | ||
uses: miniscruff/changie-action@v2 | ||
with: | ||
version: latest | ||
args: batch ${{ inputs.bump }} | ||
|
||
- name: Use Changie to Update `CHANGELOG.md` To Include All Changes | ||
uses: miniscruff/changie-action@v2 | ||
with: | ||
version: latest | ||
args: merge | ||
|
||
- name: Use Changie to Get the New Version Number | ||
id: changie-latest | ||
uses: miniscruff/changie-action@v2 | ||
with: | ||
version: latest | ||
args: latest | ||
|
||
- name: Save the New Version Into Context | ||
id: get-new-package-version | ||
run: | | ||
VERSION_WITH_V_PREFIX="${{ steps.changie-latest.outputs.output }}" | ||
VERSION=$(echo "VERSION_WITH_V_PREFIX" | cut -c 2-) | ||
echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
- name: Update Project Version in Source Code via Hatch | ||
id: update-package-version | ||
run: | | ||
hatch version "${{ steps.get-new-package-version.outputs.version }}" | ||
- name: Install `fossa-cli` | ||
# This is the recommended install method on: https://github.com/fossas/fossa-cli | ||
# There doesn't seem to be a package that can be installed instead. | ||
run: | | ||
curl -H 'Cache-Control: no-cache' | ||
https://raw.githubusercontent.com/fossas/fossa-cli/v3.9.42/install-latest.sh | ||
| bash | ||
- name: Run `fossa analyze` and Upload Report | ||
env: | ||
FOSSA_API_KEY: ${{ secrets.FOSSA_API_KEY }} | ||
run: "fossa analyze" | ||
|
||
- name: Use FOSSA Report to Update `ATTRIBUTION.md` | ||
env: | ||
FOSSA_API_KEY: ${{ secrets.FOSSA_API_KEY } | ||
run: fossa report attribution --format markdown > ./ATTRIBUTION.md | ||
|
||
- name: Fix Lint Issues in Generated Files | ||
run: "hatch -v run dev-env:pre-commit run --color=always --all-files" | ||
|
||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v4 | ||
with: | ||
branch: release-${{ steps.get-new-package-version.outputs.version }} | ||
title: "Release PR for MetricFlow ${{ steps.get-new-package-version.outputs.version }}" | ||
body: > | ||
Update changelog, version, and attribution for release version | ||
`${{ steps.package-version.outputs.version }}` | ||
labels: "Skip Changelog" | ||
commit-message: | | ||
Release version: ${{ steps.package-version.outputs.version }} | ||
* Update change log. | ||
* Update version in project configuration. | ||
* Update `ATTRIBUTION.md`. |