-
Notifications
You must be signed in to change notification settings - Fork 0
268 lines (261 loc) · 8.34 KB
/
main.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
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# Project's main software development workflow.
name: 'Workflow'
run-name: '${{ github.event_name }}: ${{ github.ref }}'
on:
issues:
types:
- opened
- edited
- labeled
- assigned
- unassigned
- unlabeled
- locked
- unlocked
issue_comment:
types:
- created
- edited
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
- labeled
pull_request_target:
types:
- opened
push:
schedule:
- cron: '43 23 * * *' # Every day at 23:43 UTC.
- cron: '43 6 * * 6' # Every Saturday at 6:43 UTC.
workflow_dispatch:
inputs:
config:
description: Configuration
type: choice
options:
- disable
- report
- pull
- pull & merge
- commit
default: report
required: true
lint:
description: Lint
type: choice
options:
- disable
- report
- pull
- pull & merge
- commit
default: report
required: true
build:
description: Build
type: boolean
default: false
required: true
test:
description: Test
type: boolean
default: false
required: true
website:
description: Website
type: boolean
default: false
required: true
release:
description: Release v1
type: boolean
default: false
required: true
jobs:
init:
name: Project
# If the event is 'pull_request_target', only run if its from a fork.
# TODO: Remove the first line after PyPackIT finalization.
if: >-
github.repository != 'RepoDynamics/PyPackIT'
&& (
github.event_name != 'pull_request_target'
|| github.event.pull_request.head.repo.full_name != github.repository
)
uses: ./.github/workflows/_manager.yaml
permissions:
contents: write
issues: write
pull-requests: write
# with:
# package-build: ${{ inputs.package-build || false }}
# package-lint: ${{ inputs.package-lint || false }}
# package-test: ${{ inputs.package-test || false }}
# website-build: ${{ inputs.website-build || false }}
# meta-sync: ${{ inputs.meta-sync }}
# hooks: ${{ inputs.hooks }}
# first-major-release: ${{ inputs.first-major-release || false }}
secrets:
repo-admin-token: ${{ secrets.REPO_ADMIN_TOKEN }}
website:
name: Website${{ matrix.config.job-suffix }}
needs: init
if: fromJSON(needs.init.outputs.run).website
permissions:
contents: read
pages: write
id-token: write
environment:
name: GitHub Pages
url: ${{ matrix.config.url }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJSON(needs.init.outputs.website) }}
runs-on: ubuntu-latest
steps:
- uses: RepoDynamics/SphinxDocs@v1
with:
repository: ${{ matrix.config.repository }}
ref: ${{ matrix.config.ref }}
path-env: ${{ matrix.config.path-env }}
path-web: ${{ matrix.config.path-web }}
path-pkg: ${{ matrix.config.path-pkg }}
artifact-name: ${{ matrix.config.artifact-name }}
deploy: ${{ matrix.config.deploy }}
lint:
name: Package Lint${{ matrix.config.job-suffix }}
needs: init
if: fromJSON(needs.init.outputs.run).lint
permissions:
pull-requests: write
security-events: write
actions: read
contents: read
strategy:
fail-fast: false
matrix:
config: ${{ fromJSON(needs.init.outputs.lint) }}
uses: ./.github/workflows/_pkg_lint.yaml
with:
config: ${{ toJSON(matrix.config) }}
test:
name: Package Test${{ matrix.config.job-suffix }}
needs: init
if: fromJSON(needs.init.outputs.run).test
permissions:
id-token: write
strategy:
fail-fast: false
matrix:
config: ${{ fromJSON(needs.init.outputs.test) }}
uses: ./.github/workflows/_pkg_test.yaml
with:
config: ${{ toJSON(matrix.config.config) }}
build:
name: Package Build${{ matrix.config.job-suffix }}
needs: init
if: fromJSON(needs.init.outputs.run).build # fromJSON(needs.init.outputs.config).run.package_build
strategy:
fail-fast: false
matrix:
config: ${{ fromJSON(needs.init.outputs.build) }}
uses: ./.github/workflows/_pkg_build.yaml
with:
config: ${{ toJSON(matrix.config) }}
# metadata: ${{ needs.init.outputs.metadata }}
# ref: ${{ fromJSON(needs.init.outputs.config).checkout.ref }}
# repository: ${{ fromJSON(needs.init.outputs.config).checkout.repository }}
publish-testpypi:
name: 'Package Publish'
needs: [init, build, test, lint]
if: fromJSON(needs.init.outputs.run).publish-testpypi # fromJSON(needs.init.outputs.config).run.package_publish_testpypi
permissions:
id-token: write
uses: ./.github/workflows/_pkg_publish.yaml
with:
config: ${{ needs.init.outputs.publish-testpypi }}
# platform: TestPyPI
# download-url: ${{ fromJSON(needs.init.outputs.config).package.download_url_testpypi }}
# upload-url: ${{ fromJSON(needs.init.outputs.config).package.upload_url_testpypi }}
test-testpypi:
name: 'Package Test: TestPyPI'
needs: [init, publish-testpypi]
if: fromJSON(needs.init.outputs.run).test-testpypi # ${{ !failure() && fromJSON(needs.init.outputs.config).run.package_test_testpypi }}
permissions:
id-token: write
uses: ./.github/workflows/_pkg_test.yaml
with:
config: ${{ needs.init.outputs.test-testpypi }}
# config: ${{ needs.init.outputs.config }}
# metadata: ${{ needs.init.outputs.metadata }}
# package-source: TestPyPI
publish-pypi:
name: 'Package Publish'
needs: [init, test-testpypi]
if: fromJSON(needs.init.outputs.run).publish-pypi # ${{ !failure() && fromJSON(needs.init.outputs.config).run.package_publish_pypi }}
permissions:
id-token: write
uses: ./.github/workflows/_pkg_publish.yaml
with:
config: ${{ needs.init.outputs.publish-pypi }}
# platform: PyPI
# download-url: ${{ fromJSON(needs.init.outputs.config).package.download_url_pypi }}
# upload-url: ${{ fromJSON(needs.init.outputs.config).package.upload_url_pypi }}
#
test-pypi:
name: 'Package Test: PyPI'
needs: [init, publish-pypi]
if: fromJSON(needs.init.outputs.run).test-pypi # ${{ !failure() && fromJSON(needs.init.outputs.config).run.package_test_pypi }}
permissions:
id-token: write
uses: ./.github/workflows/_pkg_test.yaml
with:
config: ${{ needs.init.outputs.test-pypi }}
# config: ${{ needs.init.outputs.config }}
# metadata: ${{ needs.init.outputs.metadata }}
# package-source: PyPI
#
finalize:
name: 'Finalize'
needs: [ init, build, website, test-pypi ]
if: fromJSON(needs.init.outputs.run).finalize
permissions:
contents: write
discussions: write
runs-on: ubuntu-latest
steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# ref: ${{ fromJSON(needs.init.outputs.config).checkout.ref }}
- name: 'Download sdist and wheels artifacts'
uses: actions/download-artifact@v3
with:
name: ${{ fromJSON(needs.init.outputs.finalize).release.package-artifact-name }}
path: distribution
- name: 'Download gh-pages artifact'
uses: actions/download-artifact@v3
with:
name: ${{ fromJSON(needs.init.outputs.finalize).release.website-artifact-name }}
path: documentation
- name: 'Zip artifacts'
run: |
mv distribution/dist/*.tar.gz ./
zip -r wheels.zip distribution/dist
zip -r documentation.zip documentation
- name: Release
uses: softprops/action-gh-release@v1
with:
name: ${{ fromJSON(needs.init.outputs.finalize).release.name }}
tag_name: ${{ fromJSON(needs.init.outputs.finalize).release.tag-name }}
body: ${{ fromJSON(needs.init.outputs.finalize).release.body }}
prerelease: ${{ fromJSON(needs.init.outputs.finalize).release.prerelease }}
# discussion_category_name: ${{ fromJSON(needs.init.outputs.finalize).release.discussion_category_name }}
files: |
wheels.zip
documentation.zip
*.tar.gz