-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (31 loc) · 893 Bytes
/
publish.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: Publish to PyPI
on:
release:
types: [published]
workflow_dispatch:
inputs:
repository:
description: 'PyPI repository to publish to (pypi or testpypi)'
required: true
default: 'pypi'
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # Required for private repositories and trusted publishers
steps:
- uses: actions/checkout@v4
- name: Setup PDM
uses: pdm-project/setup-pdm@v4
with:
python-version: '3.9'
cache: true
- name: Build Package
run: pdm build
- name: Set Repository
if: github.event_name == 'workflow_dispatch'
run: echo "PYPI_REPOSITORY=${{ github.event.inputs.repository }}" >> $GITHUB_ENV
- name: Publish Package
run: |
pdm publish --repository ${{ env.PYPI_REPOSITORY || 'pypi' }}