Skip to content

Release

Release #17

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
rule:
description: "Rule to run"
required: false
default: patch
type: choice
options:
- major
- minor
- patch
- premajor
- preminor
- prepatch
- prerelease
jobs:
build:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.12
- name: Install dependencies
run: |
pip install poetry
- name: Get changelog
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GH_TOKEN }}
dry_run: true
- name: Update version
run: |
poetry version ${{ github.event.inputs.rule }}
version=$(poetry version -s)
echo "VERSION=$version" >> $GITHUB_ENV
- name: Publish package
env:
PYPI_LOCAL_USERNAME: __token__
PYPI_LOCAL_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry build
poetry publish -u $PYPI_LOCAL_USERNAME -p $PYPI_LOCAL_PASSWORD
- name: Set up git
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
- uses: peter-evans/create-pull-request@v5
with:
commit-message: "[skip ci] Bump version to ${{ env.VERSION }}"
delete-branch: true
title: Bump version to ${{ env.VERSION }}
branch: release/${{ env.VERSION }}
body: |
Bump version to ${{ env.VERSION }}
${{ steps.tag_version.outputs.changelog }}
token: ${{ secrets.GH_TOKEN }}
- name: Create and push tag
run: |
git tag v${{ env.VERSION }}
git push origin v${{ env.VERSION }}
- name: Create GitHub Release
uses: actions/create-release@v1
with:
tag_name: v${{ env.VERSION }}
release_name: Release v${{ env.VERSION }}
draft: false
prerelease: false
body: ${{ steps.tag_version.outputs.changelog }}