-
Notifications
You must be signed in to change notification settings - Fork 1
64 lines (56 loc) · 1.59 KB
/
build_and_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
name: Build and Release
on:
push:
branches: ['build', 'release']
pull_request:
branches: ['main', 'master']
workflow_dispatch:
jobs:
build:
if: |
startsWith(github.ref_name, 'build') ||
startsWith(github.ref_name, 'release')
name: Build sdist and wheels
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
python -m venv --system-site-packages .local
echo "$HOME/.local/bin" >> $GITHUB_PATH
python -m pip install --upgrade pip build setuptools
- name: Build and verify its integrity
run: |
python -m build --no-isolation
for f in dist/tremolo-*.tar.gz; do
gzip -t "$f"
done
for f in dist/tremolo-*.whl; do
unzip -t "$f"
done
- uses: actions/upload-artifact@v3
with:
name: dist
path: dist/tremolo-*
release:
if: |
startsWith(github.ref_name, 'build') ||
startsWith(github.ref_name, 'release')
name: Upload release to PyPI
needs: ['build']
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/tremolo
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/download-artifact@v3
with:
name: dist
path: dist
- run: |
tree -L 2
- name: Publish to PyPI
if: ${{ startsWith(github.ref_name, 'release') }}
uses: pypa/gh-action-pypi-publish@release/v1