-
Notifications
You must be signed in to change notification settings - Fork 3
87 lines (75 loc) · 2.17 KB
/
publish_to_pypi.yml
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Publish to PyPI
on:
workflow_dispatch:
inputs:
test:
description: publish to test pypi
required: false
default: false
type: boolean
# Change to this once workflow has been tested
# on:
# release:
# types: [released]
jobs:
build_artifacts:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.11'
- name: Install build tools
shell: 'bash'
run: python -m pip install build
- name: Build sdist
shell: 'bash'
run: python -m build --sdist --wheel .
- uses: actions/upload-artifact@v4
with:
path: dist/*
publish_testpypi:
needs: [ build_artifacts ]
if: ${{ inputs.test == 'true' }}
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
- name: Publish package distributions to TEST PyPI
uses: pypa/[email protected]
with:
name: testpypi
user: ${{ secrets.PYPI_USERNAME_SPACEKIT_MAINTAINER }}
password: ${{ secrets.PYPI_PASSWORD_SPACEKIT_MAINTAINER_TEST }}
repository-url: https://test.pypi.org/legacy/
verify-metadata: true
skip-existing: false
verbose: true
publish_pypi:
needs: [ build_artifacts ]
if: ${{ inputs.test == 'false' }}
runs-on: ubuntu-latest
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
- name: Publish package distributions to PyPI
uses: pypa/[email protected]
with:
name: pypi
user: ${{ secrets.PYPI_USERNAME_SPACEKIT_MAINTAINER }}
password: ${{ secrets.PYPI_PASSWORD_SPACEKIT_MAINTAINER }}
repository-url: https://pypi.org/p/spacekit
verify-metadata: true
skip-existing: false
verbose: false