Skip to content

Commit d12620f

Browse files
authored
chore: update GH actions to generate CHANGELOG (#194)
1 parent d474559 commit d12620f

File tree

2 files changed

+50
-63
lines changed

2 files changed

+50
-63
lines changed

.github/workflows/on-push-tag.yml

Lines changed: 21 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
# This workflow runs when a version tag is pushed.
22
#
3-
# - Job 1:
4-
# - Get new tag.
5-
# - Build new release.
6-
# - If release candidate tag:
7-
# - Cut PR to merge files and create release/* branch.
8-
# - Generate GitHub (pre-)release if build succeeds.
9-
# - Upload wheel to GitHub (pre-)release if build succeeds.
10-
# - If release tag:
11-
# - Update CHANGELOG.md
12-
# - Upload wheel to Test PyPi if build succeeds. (Future)
13-
# - Test install from Test PyPi. (Future)
14-
# - Upload wheel to PyPi if test install succeeds. (Future)
3+
# - Get new tag.
4+
# - Build new release.
5+
# - If release tag:
6+
# - Build release.
7+
# - Generate GitHub release if build succeeds.
8+
# - Upload wheel to GitHub release if build succeeds.
9+
# - Upload wheel to Test PyPi if build succeeds. (Future)
10+
# - Test install from Test PyPi. (Future)
11+
# - Upload wheel to PyPi if test install succeeds. (Future)
1512
name: Push Version Tag Workflow
1613

1714
on:
@@ -47,69 +44,33 @@ jobs:
4744
pip install -U pip poetry twine
4845
poetry build && twine check dist/* && echo "build_ok=1" >> $GITHUB_ENV
4946
50-
- name: Open release pull request
51-
uses: peter-evans/create-pull-request@v3
52-
if: ${{ contains( steps.newversion.output.new_tag, 'rc' ) }}
53-
with:
54-
commit-message: "release: ${{ steps.newversion.outputs.new_version }}"
55-
title: "release: ${{ steps.newversion.outputs.new_version }}"
56-
body: "Please cut release ${{ steps.newversion.outputs.new_version }}"
57-
branch: "release/${{ steps.newversion.outputs.new_version }}"
58-
base: master
59-
labels: release
60-
61-
- name: Cut the pre-release
62-
id: cutprerelease
63-
if: ${{ contains( steps.newversion.output.new_tag, 'rc' ) && env.build_ok == 1 }}
47+
- name: Cut the release
48+
id: cutrelease
49+
if: ${{ !contains( steps.newversion.output.new_tag, 'rc' ) && env.build_ok == 1 }}
6450
uses: release-drafter/release-drafter@v5
6551
with:
6652
name: "v${{ steps.newversion.outputs.new_tag }}"
6753
tag: "v${{ steps.newversion.outputs.new_tag }}"
6854
version: "${{ steps.newversion.outputs.new_tag }}"
69-
prerelease: true
55+
prerelease: false
7056
publish: true
7157
env:
7258
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7359

74-
- name: Print release candidate info
60+
- name: Print release info
7561
run: |
76-
echo ${{ steps.cutprerelease.outputs.id }}
77-
echo ${{ steps.cutprerelease.outputs.name }}
78-
echo ${{ steps.cutprerelease.outputs.tag_name }}
79-
echo ${{ steps.cutprerelease.outputs.html_url }}
80-
echo ${{ steps.cutprerelease.outputs.upload_url }}
62+
echo ${{ steps.cutrelease.outputs.id }}
63+
echo ${{ steps.cutrelease.outputs.name }}
64+
echo ${{ steps.cutrelease.outputs.tag_name }}
65+
echo ${{ steps.cutrelease.outputs.html_url }}
66+
echo ${{ steps.cutrelease.outputs.upload_url }}
8167
8268
- name: Upload wheel to GitHub release
8369
id: upload-wheel
84-
if: ${{ contains( steps.newversion.output.new_tag, 'rc' ) && env.build_ok == 1 }}
70+
if: ${{ env.build_ok == 1 }}
8571
uses: shogo82148/actions-upload-release-asset@v1
8672
with:
87-
upload_url: ${{ steps.cutprerelease.outputs.upload_url }}
88-
89-
- name: Generate release changelog
90-
uses: heinrichreimer/github-changelog-generator-action@master
91-
if: ${{ !contains( steps.newversion.output.new_tag, 'rc' ) && env.build_ok == 1 }}
92-
with:
93-
token: ${{ secrets.GITHUB_TOKEN }}
94-
sinceTag: "v1.3.1"
95-
excludeTags: "latest"
96-
breakingLabel: "Breaking Changes"
97-
breakingLabels: "V: major"
98-
enhancementLabel: "New Features"
99-
enhancementLabels: "P: enhancement"
100-
bugsLabel: "Bug Fixes"
101-
bugLabels: "P: bug"
102-
excludeLabels: "release"
103-
issues: false
104-
issuesWoLabels: false
105-
maxIssues: 100
106-
pullRequests: true
107-
prWoLabels: false
108-
author: true
109-
unreleased: true
110-
compareLink: true
111-
stripGeneratorNotice: true
112-
verbose: true
73+
upload_url: ${{ steps.cutrelease.outputs.upload_url }}
11374

11475
# - name: Publish to Test PyPi
11576
# if: ${{ !contains( steps.newversion.output.new_tag, 'rc' ) && env.build_ok == 1 }}
Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# This workflow runs when a pull request is closed.
22
#
33
# - Gets list of PR labels.
4-
# - IF 'release' label:
4+
# - If 'release' label:
55
# - Get release version using Poetry.
6+
# - Generate new CHANGELOG.
67
# - Get next semantic version.
78
# - Close old milestones.
89
# - Create new minor version milestone.
@@ -27,7 +28,7 @@ jobs:
2728

2829
- name: Get PR labels
2930
id: prlabels
30-
uses: joerick/pr-labels-action@v1.0.6
31+
uses: joerick/pr-labels-action@v1.0.8
3132

3233
- name: Get release version
3334
id: relversion
@@ -37,10 +38,35 @@ jobs:
3738
echo "version=$(echo $(poetry version | cut -d' ' -f2))" >> $GITHUB_OUTPUT
3839
echo "do_milestones=1" >> $GITHUB_ENV
3940
41+
- name: Generate release changelog
42+
uses: heinrichreimer/github-changelog-generator-action@master
43+
if: ${{ env.do_milestones == 1 }}
44+
with:
45+
token: ${{ secrets.GITHUB_TOKEN }}
46+
sinceTag: "v1.3.1"
47+
excludeTags: "latest"
48+
breakingLabel: "Breaking Changes"
49+
breakingLabels: "V: major"
50+
enhancementLabel: "New Features"
51+
enhancementLabels: "P: enhancement"
52+
bugsLabel: "Bug Fixes"
53+
bugLabels: "P: bug"
54+
excludeLabels: "release"
55+
issues: false
56+
issuesWoLabels: false
57+
maxIssues: 100
58+
pullRequests: true
59+
prWoLabels: false
60+
author: true
61+
unreleased: true
62+
compareLink: true
63+
stripGeneratorNotice: true
64+
verbose: true
65+
4066
- name: Get next semantic version
4167
id: nextversion
4268
if: ${{ env.do_milestones == 1 }}
43-
uses: WyriHaximus/github-action-next-semvers@v1.1.0
69+
uses: WyriHaximus/github-action-next-semvers@v1.2.1
4470
with:
4571
version: ${{ steps.relversion.outputs.version }}
4672

0 commit comments

Comments
 (0)