Skip to content

Commit

Permalink
/* PR_START p--release-setup 02 */ Add Github Action workflow to crea…
Browse files Browse the repository at this point in the history
…te a release PR.
  • Loading branch information
plypaul committed Jan 16, 2025
1 parent f861c49 commit 3d6da26
Showing 1 changed file with 90 additions and 0 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/cd-create-release-pr.yaml
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`.

0 comments on commit 3d6da26

Please sign in to comment.