Skip to content

Release

Release #49

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
description: Version Number
required: true
release:
description: Make Release
required: true
type: boolean
changelog:
description: Update Changelog
required: true
type: boolean
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ env.GITHUB_REF }}
token: ${{ secrets.GH_TOKEN }}
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Extract Release Notes
run: |
python ./extract-release-notes.py v${{ github.event.inputs.version }}
- name: Config Git Username
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
- name: Update Changelog
if: ${{ github.event.inputs.changelog == 'true' }}
run: |
git add .
git diff-index --quiet HEAD || git commit -m ":memo: update changelog"
git push
- name: Release to Public
if: ${{ github.event.inputs.release == 'true' }}
run: |
python ./bump-version.py ${{ github.event.inputs.version }}
pip install pdm twine
pdm build
twine upload --username __token__ --password ${{ secrets.PYPI_TOKEN }} dist/*
git add .
git diff-index --quiet HEAD || git commit -m ":sparkles: ${{ github.event.inputs.version }}"
git push
gh release create "v${{ github.event.inputs.version }}" dist/* --notes-file ./release-notes.md --title "✨ v${{ github.event.inputs.version }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Build Artifacts
if: ${{ github.event.inputs.release == 'true' }}
uses: actions/upload-artifact@v3
with:
name: "dist-${{ github.event.inputs.version }}"
path: dist/
- name: Merge to Master
if: ${{ github.event.inputs.changelog == 'true' }}
run: |
git checkout origin/master -b master
git merge $GITHUB_REF --ff-only
git push --set-upstream origin master