| 1 |
name: deploy |
| 2 |
|
| 3 |
on: |
| 4 |
workflow_dispatch: |
| 5 |
inputs: |
| 6 |
version: |
| 7 |
description: 'Release version' |
| 8 |
required: true |
| 9 |
default: '1.2.3' |
| 10 |
|
| 11 |
jobs: |
| 12 |
|
| 13 |
package: |
| 14 |
runs-on: ubuntu-latest |
| 15 |
env: |
| 16 |
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ github.event.inputs.version }} |
| 17 |
|
| 18 |
steps: |
| 19 |
- uses: actions/checkout@v4 |
| 20 |
|
| 21 |
- name: Build and Check Package |
| 22 |
uses: hynek/[email protected] |
| 23 |
|
| 24 |
deploy: |
| 25 |
needs: package |
| 26 |
runs-on: ubuntu-latest |
| 27 |
environment: deploy |
| 28 |
permissions: |
| 29 |
id-token: write # For PyPI trusted publishers. |
| 30 |
contents: write # For tag. |
| 31 |
|
| 32 |
steps: |
| 33 |
- uses: actions/checkout@v4 |
| 34 |
|
| 35 |
- name: Download Package |
| 36 |
uses: actions/download-artifact@v4 |
| 37 |
with: |
| 38 |
name: Packages |
| 39 |
path: dist |
| 40 |
|
| 41 |
- name: Publish package to PyPI |
| 42 |
uses: pypa/[email protected] |
| 43 |
with: |
| 44 |
attestations: true |
| 45 |
|
| 46 |
- name: Push tag |
| 47 |
run: | |
| 48 |
git config user.name "pytest bot" |
| 49 |
git config user.email "[email protected]" |
| 50 |
git tag --annotate --message=v${{ github.event.inputs.version }} v${{ github.event.inputs.version }} ${{ github.sha }} |
| 51 |
git push origin v${{ github.event.inputs.version }} |
| 52 |
|
| 53 |
- name: GitHub Release |
| 54 |
uses: softprops/action-gh-release@v2 |
| 55 |
with: |
| 56 |
files: dist/* |
| 57 |
tag_name: v${{ github.event.inputs.version }} |