68 lines
1.6 KiB
YAML
68 lines
1.6 KiB
YAML
name: deploy
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: 'Release version'
|
|
required: true
|
|
default: '1.2.3'
|
|
|
|
jobs:
|
|
|
|
package:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ github.event.inputs.version }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Build and Check Package
|
|
uses: hynek/build-and-inspect-python-package@v1.5
|
|
|
|
deploy:
|
|
needs: package
|
|
runs-on: ubuntu-latest
|
|
environment: deploy
|
|
permissions:
|
|
id-token: write # For PyPI trusted publishers.
|
|
contents: write # For tag and release notes.
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Download Package
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: Packages
|
|
path: dist
|
|
|
|
- name: Publish package to PyPI
|
|
uses: pypa/gh-action-pypi-publish@v1.8.5
|
|
|
|
- name: Push tag
|
|
run: |
|
|
git config user.name "pytest bot"
|
|
git config user.email "pytestbot@gmail.com"
|
|
git tag --annotate --message=v${{ github.event.inputs.version }} v${{ github.event.inputs.version }} ${{ github.sha }}
|
|
git push origin v${{ github.event.inputs.version }}
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4.5.0
|
|
with:
|
|
python-version: "3.10"
|
|
|
|
- name: Generate release notes
|
|
run: |
|
|
pip install pypandoc
|
|
sudo apt-get install pandoc
|
|
python scripts/gen-release-notes.py
|
|
|
|
- name: GitHub Release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
body_path: scripts/latest-release-notes.md
|
|
files: dist/*
|
|
tag_name: v${{ github.event.inputs.version }}
|