-
Notifications
You must be signed in to change notification settings - Fork 5
110 lines (94 loc) · 2.75 KB
/
publish.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Publish PyPI
on:
workflow_dispatch:
release:
types: [published]
jobs:
build-user-guide:
uses: mbsantiago/whombat/.github/workflows/build_user_guide.yml@dev
build-frontend:
uses: mbsantiago/whombat/.github/workflows/build_frontend.yml@dev
build:
runs-on: ubuntu-latest
needs: [build-user-guide, build-frontend]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: actions/download-artifact@v4
with:
name: frontend
path: back/src/whombat/statics/
- uses: actions/download-artifact@v4
with:
name: user_guide
path: back/src/whombat/user_guide/
- name: Install pypa/build
run: pip install build
- name: Build a binary wheel and source tarball
run: |
cd back
python -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: back/dist/
publish-to-pypi:
name: Publish to PyPI
needs: [build]
runs-on: ubuntu-latest
if: github.event_name == 'release'
environment:
name: pypi
url: https://pypi.org/p/whombat
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
github-release:
name: Upload to GitHub release
needs: [publish-to-pypi]
runs-on: ubuntu-latest
if: github.event_name == 'release'
permissions:
contents: write
id-token: write
steps:
- name: Download the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Upload artifact to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
gh release upload '${{ github.ref_name }}' dist/** --repo '${{github.repository }}'
publish-to-testpypi:
name: Publish to TestPyPI
needs: [build]
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
environment:
name: testpypi
url: https://test.pypi.org/p/whombat
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/