Skip to content

Commit

Permalink
chore: move changelog to tag workflow (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
weibullguy authored Jun 7, 2023
1 parent 7f164ee commit f9c7d4c
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 47 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/do-prioritize-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ jobs:
uses: weibullguy/get-labels-action@main

- name: Add High Urgency Labels
if: '${{ (contains(steps.getlabels.outputs.labels, "C: convention") && contains (steps.getlabels.outputs.labels, "P: bug")) }}'
if: "${{ (contains(steps.getlabels.outputs.labels, 'C: convention') && contains (steps.getlabels.outputs.labels, 'P: bug')) }}"
uses: andymckay/labeler@master
with:
add-labels: "U: high"

- name: Add Medium Urgency Labels
if: '${{ (contains(steps.getlabels.outputs.labels, "C: style") && contains(steps.getlabels.outputs.labels, "P: bug")) || (contains(steps.getlabels.outputs.labels, "C: stakeholder") && contains(steps.getlabels.outputs.labels, "P: bug")) || (contains(steps.getlabels.outputs.labels, "C: convention") && contains(steps.getlabels.outputs.labels, "P: enhancement")) }}'
if: "${{ (contains(steps.getlabels.outputs.labels, 'C: style') && contains(steps.getlabels.outputs.labels, 'P: bug')) || (contains(steps.getlabels.outputs.labels, 'C: stakeholder') && contains(steps.getlabels.outputs.labels, 'P: bug')) || (contains(steps.getlabels.outputs.labels, 'C: convention') && contains(steps.getlabels.outputs.labels, 'P: enhancement')) }}"
uses: andymckay/labeler@master
with:
add-labels: "U: medium"

- name: Add Low Urgency Labels
if: '${{ (contains(steps.getlabels.outputs.labels, "C: style") && contains(steps.getlabels.outputs.labels, "P: enhancement")) || (contains(steps.getlabels.outputs.labels, "C: stakeholder") && contains(steps.getlabels.outputs.labels, "P: enhancement")) || contains(steps.getlabels.outputs.labels, "doc") || contains(steps.getlabels.outputs.labels, "chore") }}'
if: "${{ (contains(steps.getlabels.outputs.labels, 'C: style') && contains(steps.getlabels.outputs.labels, 'P: enhancement')) || (contains(steps.getlabels.outputs.labels, 'C: stakeholder') && contains(steps.getlabels.outputs.labels, 'P: enhancement')) || contains(steps.getlabels.outputs.labels, 'doc') || contains(steps.getlabels.outputs.labels, 'chore') }}"
uses: andymckay/labeler@master
with:
add-labels: "U: low"
44 changes: 0 additions & 44 deletions .github/workflows/do-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,50 +41,6 @@ jobs:
echo "version=$(echo $(poetry version | cut -d' ' -f2))" >> $GITHUB_OUTPUT
echo "do_release=1" >> $GITHUB_ENV
- name: Generate release changelog
uses: heinrichreimer/github-changelog-generator-action@master
if: ${{ env.do_release == 1 }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
sinceTag: "v1.3.1"
excludeTagsRegex: "-rc[0-9]"
breakingLabel: "Breaking Changes"
breakingLabels: "V: major"
enhancementLabel: "Features"
enhancementLabels: "P: enhancement"
bugsLabel: "Bug Fixes"
bugLabels: "P: bug"
excludeLabels: "release"
issues: false
issuesWoLabels: false
maxIssues: 100
pullRequests: true
prWoLabels: false
author: true
unreleased: true
compareLink: true
stripGeneratorNotice: true
verbose: true

- name: Check if diff
if: ${{ env.do_release == 1 }}
continue-on-error: true
run: >
git diff --exit-code CHANGELOG.md &&
(echo "### No update" && exit 1) || (echo "### Commit update")
- uses: EndBug/add-and-commit@v9
name: Commit and push if diff
if: ${{ env.do_release == 1 }}
with:
add: CHANGELOG.md
message: 'chore: update CHANGELOG.md for new release'
author_name: GitHub Actions
author_email: [email protected]
committer_name: GitHub Actions
committer_email: [email protected]
push: true

- name: Build release
id: build
if: ${{ env.do_release == 1 }}
Expand Down
68 changes: 68 additions & 0 deletions .github/workflows/on-push-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,74 @@ on:
- 'v*'

jobs:
update_changelog:
name: Update Changelog
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: master

- name: Get new tag
id: newversion
run: |
tag=${GITHUB_REF/refs\/tags\//}
version=$(echo $tag | sed 's/-rc[0-9]*//')
if [[ $tag != *"-rc"* ]]; then
echo "do_changelog=1" >> $GITHUB_ENV
echo "tag=$(echo $tag)" >> $GITHUB_OUTPUT
echo "version=$(echo $version)" >> $GITHUB_OUTPUT
fi
echo "New tag is: $tag"
echo "New version is: $version"
echo "GitHub ref: ${{ github.ref }}"
- name: Generate release changelog
uses: heinrichreimer/github-changelog-generator-action@master
if: ${{ env.do_changelog == 1 }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
sinceTag: "v1.3.1"
excludeTagsRegex: "-rc[0-9]"
breakingLabel: "Breaking Changes"
breakingLabels: "V: major"
enhancementLabel: "Features"
enhancementLabels: "P: enhancement"
bugsLabel: "Bug Fixes"
bugLabels: "P: bug"
excludeLabels: "release"
issues: false
issuesWoLabels: false
maxIssues: 100
pullRequests: true
prWoLabels: false
author: true
unreleased: true
compareLink: true
stripGeneratorNotice: true
verbose: true

- name: Check if diff
if: ${{ env.do_changelog == 1 }}
continue-on-error: true
run: >
git diff --exit-code CHANGELOG.md &&
(echo "### No update" && exit 1) || (echo "### Commit update")
- uses: EndBug/add-and-commit@v9
name: Commit and push if diff
if: ${{ env.do_changelog == 1 }}
with:
add: CHANGELOG.md
message: 'chore: update CHANGELOG.md for new release'
author_name: GitHub Actions
author_email: [email protected]
committer_name: GitHub Actions
committer_email: [email protected]
push: true

manage_milestones:
name: Manage Milestones
runs-on: ubuntu-latest
Expand Down

0 comments on commit f9c7d4c

Please sign in to comment.