chore: update version strings #52
Workflow file for this run
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
# This workflow runs when a version tag is pushed. | |
# | |
# - Get new tag. | |
# - If version tag: | |
# - If release condidate tag: | |
# - Build the pre-release. | |
# - Cut GitHub pre-release. | |
# - Upload wheel to pre-release. | |
# - If release tag: | |
# - Generate new CHANGELOG. | |
# - Get next semantic version. | |
# - Close old milestones. | |
# - Create new minor version milestone. | |
# - Create new major version milestone. | |
name: Version Tag Workflow | |
on: | |
push: | |
tags: | |
- '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\//} | |
if [[ $tag == *"-rc"* ]]; then | |
echo "do_prerelease=1" >> $GItHUB_ENV | |
fi | |
if [[ $tag != *"-rc"* ]]; then | |
echo "do_changelog=1" >> $GITHUB_ENV | |
fi | |
echo "tag=$(echo $tag)" >> $GITHUB_OUTPUT | |
echo "New tag is: $tag" | |
echo "GitHub ref: ${{ github.ref }}" | |
- name: Build pre-release | |
id: build | |
if: ${{ env.do_prerelease == 1 }} | |
run: | | |
pip install -U pip poetry twine | |
poetry build && twine check dist/* && echo "build_ok=1" >> $GITHUB_ENV | |
- name: Cut pre-release | |
id: cutprerelease | |
if: ${{ env.build_ok == 1 }} | |
uses: release-drafter/release-drafter@v5 | |
with: | |
name: $env.tag | |
tag: $env.tag | |
version: $env.tag | |
prerelease: true | |
publish: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload wheel to GitHub pre-release | |
id: upload-wheel | |
if: ${{ env.build_ok == 1 }} | |
uses: shogo82148/actions-upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.cutprerelease.outputs.upload_url }} | |
asset_path: ./dist/*.whl | |
- 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: action@github.com | |
committer_name: GitHub Actions | |
committer_email: actions@github.com | |
push: true | |
manage_milestones: | |
name: Manage Milestones | |
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_milestones=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: Get next semantic version | |
id: nextversion | |
if: ${{ env.do_milestones == 1 }} | |
uses: WyriHaximus/github-action-next-semvers@v1.2.1 | |
with: | |
version: ${{ steps.newversion.outputs.version }} | |
- name: Close old milestone | |
if: ${{ env.do_milestones == 1 }} | |
uses: WyriHaximus/github-action-close-milestone@master | |
with: | |
number: ${{ steps.newversion.outputs.version }} | |
- name: Create new minor release milestone | |
if: ${{ env.do_milestones == 1 }} | |
uses: WyriHaximus/github-action-create-milestone@v1.2.0 | |
with: | |
title: "${{ steps.nextversion.outputs.v_minor }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create new major release milestone | |
if: ${{ env.do_milestones == 1 }} | |
uses: WyriHaximus/github-action-create-milestone@v1.2.0 | |
with: | |
title: "${{ steps.nextversion.outputs.v_major }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |