-
Notifications
You must be signed in to change notification settings - Fork 99
90 lines (77 loc) · 2.97 KB
/
cd-create-release-pr.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
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@v7
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.get-new-package-version.outputs.version }}`
labels: "Skip Changelog"
commit-message: |
Release version: ${{ steps.get-new-package-version.outputs.version }}
* Update change log.
* Update version in project configuration.
* Update `ATTRIBUTION.md`.