Repository navigation
76 lines (72 loc) · 2.35 KB
/
Copy pathrelease.yml
File metadata and controls
76 lines (72 loc) · 2.35 KB
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
name: Release
# Publishes to PyPI when a GitHub release is published.
# Run it by hand (workflow_dispatch) to build everything and publish to TestPyPI instead.
on:
release:
types: [published]
workflow_dispatch:
jobs:
sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check out the SOFIE sources that are built
run: ./packaging/init_sofie.sh
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Check that the tag matches the version
if: github.event_name == 'release'
run: |
version=$(sed -n 's/^__version__ = "\(.*\)"/\1/p' python/sofie/__init__.py)
test "v$version" = "${{ github.event.release.tag_name }}" || { echo "tag ${{ github.event.release.tag_name }} != version $version"; exit 1; }
- run: python3 -m pip install build twine
- run: python3 -m build --sdist --outdir dist .
- run: python3 -m twine check dist/*
- uses: actions/upload-artifact@v4
with:
name: dist-sdist
path: dist/*.tar.gz
wheels:
needs: sdist
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm]
steps:
- uses: actions/download-artifact@v4
with:
name: dist-sdist
path: sdist
- name: Find the sdist
id: sdist
run: echo "path=$(ls sdist/*.tar.gz)" >> "$GITHUB_OUTPUT"
- uses: pypa/cibuildwheel@v2.23.3
with:
package-dir: ${{ steps.sdist.outputs.path }}
output-dir: wheelhouse
- uses: actions/upload-artifact@v4
with:
name: dist-wheels-${{ matrix.os }}
path: wheelhouse/*.whl
publish:
needs: [sdist, wheels]
runs-on: ubuntu-latest
environment: ${{ github.event_name == 'release' && 'pypi' || 'testpypi' }}
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: dist-*
path: dist
merge-multiple: true
- name: Publish to TestPyPI
if: github.event_name != 'release'
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
- name: Publish to PyPI
if: github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@release/v1