-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (94 loc) · 3.41 KB
/
Copy pathrelease.yaml
File metadata and controls
106 lines (94 loc) · 3.41 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
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
name: Release
# Build sdist + wheel on every push, publish only on tagged releases.
# Tag format: v0.1.0, v0.2.0, etc. Pre-releases (e.g. v0.2.0a1) go to TestPyPI;
# stable tags go to PyPI.
#
# Trusted Publisher setup (one-time, in PyPI/TestPyPI project settings):
# - PyPI: workflow=release.yaml, environment=pypi
# - TestPyPI: workflow=release.yaml, environment=testpypi
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+[ab][0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
workflow_dispatch:
inputs:
target:
description: "Where to publish (testpypi or pypi)"
type: choice
options: [testpypi, pypi]
default: testpypi
permissions:
contents: read
jobs:
build:
name: Build sdist + wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: true
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install build tooling
run: python -m pip install --upgrade build
- name: Build distributions
run: python -m build
- name: Verify wheel contents include vendored engine assets
run: |
python -m pip install --quiet wheel
python -m wheel unpack --dest /tmp/unpacked dist/*.whl
for f in pymyio/static/myIOapi.js pymyio/static/style.css \
pymyio/static/lib/d3.min.js \
pymyio/static/lib/d3-hexbin.js \
pymyio/static/lib/d3-sankey.min.js; do
test -s "/tmp/unpacked/pymyio-"*"/$f" || { echo "missing: $f"; exit 1; }
done
- name: Smoke install + import in clean venv
run: |
python -m venv /tmp/venv
/tmp/venv/bin/pip install --quiet dist/*.whl
/tmp/venv/bin/python -c "import pymyio; from pymyio import MyIO; print('pymyio', pymyio.__version__)"
- uses: actions/upload-artifact@v7
with:
name: dist
path: dist/
publish-testpypi:
name: Publish to TestPyPI
needs: build
# Pre-release tags (e.g. v0.1.0a1, v0.2.0rc1) or manual dispatch to testpypi.
# Use ref_name (tag only) not ref (refs/tags/...), to avoid 'a' matching 'tags'.
if: |
(github.event_name == 'push' && (contains(github.ref_name, 'a') || contains(github.ref_name, 'b') || contains(github.ref_name, 'rc')))
|| (github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'testpypi')
runs-on: ubuntu-latest
environment: testpypi
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v8
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
publish-pypi:
name: Publish to PyPI
needs: build
# Stable tags only (e.g. v0.1.0, v1.2.0). No a/b/rc suffix.
if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && !contains(github.ref_name, 'a') && !contains(github.ref_name, 'b') && !contains(github.ref_name, 'rc'))
|| (github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'pypi')
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v8
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1