-
Notifications
You must be signed in to change notification settings - Fork 1
56 lines (55 loc) · 1.62 KB
/
main-workflow.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
name: Cellarium CAS Repository Update Workflow
on:
push:
workflow_dispatch:
inputs:
pypi-type:
description: 'The type of PyPI deployment to perform or none'
required: true
default: 'none'
type: choice
options:
- none
- test
- prod
skip-unit-tests:
description: 'Skip the unit tests'
required: false
default: false
type: boolean
jobs:
unit-tests:
runs-on: ubuntu-latest
if: ${{ !github.event.inputs.skip-unit-tests }}
strategy:
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10' ]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/unit-tests
env:
TEST_API_TOKEN: ${{ secrets.TEST_API_TOKEN }}
TEST_API_URL: ${{ secrets.TEST_API_URL }}
with:
python-version: ${{ matrix.python-version }}
publish-to-pypi:
runs-on: ubuntu-latest
needs:
- unit-tests
if: |
always()
&& !cancelled()
&& contains(fromJson('["skipped", "success"]'), needs.unit-tests.result)
&& github.event_name == 'workflow_dispatch'
&& github.event.inputs.pypi-type != 'none'
permissions:
id-token: write
environment:
name: ${{ inputs.pypi-type == 'prod' && 'pypi' || 'test-pypi'}}
url: ${{ inputs.pypi-type == 'prod' && 'https://pypi.org/p/cellarium-cas' || 'https://test.pypi.org/p/cellarium-cas'}}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/pypi-deploy
with:
python-version: '3.7'
pypi-type: ${{ inputs.pypi-type }}