-
Notifications
You must be signed in to change notification settings - Fork 8
151 lines (138 loc) · 4.2 KB
/
deploy.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Deploy
on:
push:
branches: [main]
jobs:
last-minute-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: set up python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
- run: pip install . montepy[develop]
- run: python -m pytest
build-pages:
needs: [last-minute-test, build-packages]
environment:
name: github-pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
ref: main
- uses: actions/setup-python@v5
with:
python-version: 3.12
- run: pip install --user . montepy[doc]
- run: cd doc && make html
- uses: actions/configure-pages@v4
- uses: actions/upload-pages-artifact@v3
with:
name: deploy-pages
path: doc/build/html/
build-packages:
name: Build, sign, and release packages on github
runs-on: ubuntu-latest
needs: [last-minute-test]
permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: set up python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
- run: pip install . montepy[build]
- name: Get Version
id: get_version
run: echo "version=`python -m setuptools_scm`" >> $GITHUB_OUTPUT
- name: Verify that this is a non-dev release
run: .github/scripts/check_version.sh ${{ steps.get_version.outputs.version }}
- run: python -m build .
- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: v${{ steps.get_version.outputs.version }}
name: Release ${{ steps.get_version.outputs.version }}
draft: true
- run: >-
gh release upload
'v${{ steps.get_version.outputs.version }}' dist/**
--repo '${{ github.repository }}'
- uses: actions/upload-artifact@v4
with:
name: build
path: |
dist/*.tar.gz
dist/*.whl
deploy-pages:
permissions:
contents: read
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: [build-pages, last-minute-test]
runs-on: ubuntu-latest
steps:
- run: ls -l
- uses: actions/download-artifact@v4
with:
name: deploy-pages
- run: ls -l
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
with:
artifact_name: deploy-pages
deploy-test-pypi:
environment:
name: test-pypi
url: https://test.pypi.org/p/montepy # Replace <package-name> with your PyPI project name
needs: [deploy-pages, build-packages]
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: build
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
deploy-pypi:
environment:
name: pypi
url: https://pypi.org/p/montepy # Replace <package-name> with your PyPI project name
needs: [deploy-pages, deploy-test-pypi, build-packages]
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: build
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1