Python Package Release #107
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
name: Python Package Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version Tag in the form X.Y.Z' | |
required: true | |
type: string | |
jobs: | |
build: | |
if: github.actor != 'github-actions[bot]' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: ${{ secrets.APPLICATION_ID }} | |
private-key: ${{ secrets.APPLICATION_PRIVATE_KEY }} | |
- name: Checkout code | |
uses: actions/checkout@v4.1.7 | |
with: | |
fetch-tags: true | |
fetch-depth: 0 | |
ref: main | |
token: ${{ steps.app-token.outputs.token }} # Needed to trigger other actions | |
- name: Set up Python | |
uses: actions/setup-python@v5.1.1 | |
with: | |
python-version: "3.9" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install hatch git-cliff | |
- name: Bump version and create | |
run: | | |
git tag ${{ inputs.version }} | |
git push origin ${{ inputs.version }} | |
- name: Update Changelog | |
run: | | |
hatch version ${{ inputs.version }} | |
git cliff -o CHANGELOG.md | |
- name: Commit and push changes | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git add . | |
git commit -m "Update version and changelog" | |
git push --follow-tags | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
with: | |
tag_name: ${{ inputs.version }} | |
release_name: Release ${{ inputs.version }} | |
draft: false | |
prerelease: false |