-
Notifications
You must be signed in to change notification settings - Fork 49
70 lines (68 loc) · 1.94 KB
/
deploy-release.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
name: Deploy Python Distribution
on:
push:
branches: [main]
pull_request:
branches: [main]
release:
types: [published]
workflow_dispatch:
jobs:
build:
name: Build Python distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install pypa/build
run: |
python -m pip install build --user
- name: Build a wheel and a source tarball
run: |
python -m build --sdist --wheel --outdir dist/
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: gt4py-dist
path: ./dist/**
publish-pypi:
name: Publish Python distribution to pypi.org
runs-on: ubuntu-latest
needs: build
if: ${{ github.event_name == 'workflow_dispatch' }} # the action was triggered manually
environment:
name: pypi
url: https://pypi.org/project/gt4py
permissions:
id-token: write
steps:
- name: Download wheel
uses: actions/download-artifact@v3
with:
name: gt4py-dist
path: dist
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
publish-test-pypi:
name: Publish Python distribution to test.pypi.org
runs-on: ubuntu-latest
needs: build
if: ${{ github.event_name == 'release' }} # triggered by releasing on github, test first before manually triggering the deployment to PyPI (see release documentation)
environment:
name: testpypi
url: https://test.pypi.org/project/gt4py/
permissions:
id-token: write
steps:
- name: Download wheel
uses: actions/download-artifact@v3
with:
name: gt4py-dist
path: dist
- name: Publish distribution to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/