-
Notifications
You must be signed in to change notification settings - Fork 10
62 lines (54 loc) · 1.98 KB
/
deploy-ast.yml
File metadata and controls
62 lines (54 loc) · 1.98 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
name: Deploy Reference Python Package
on:
push:
tags:
- 'v*'
jobs:
build:
uses: ./.github/workflows/build-ast.yml
deploy:
name: Deploy to PyPI
needs: build
runs-on: ubuntu-latest
steps:
# There's deliberately no check-out step here, because we don't want the
# checkout anywhere near us complicating matters; we're just trying to
# ensure that the pre-built wheel works, and its version matches what we
# expect from the tag.
- uses: actions/setup-python@v3
with:
# The version checker uses 'importlib.metadata' which is Python 3.10+.
python-version: '3.10'
- uses: actions/download-artifact@v4
with:
name: openpulse-python-wheel
- uses: actions/download-artifact@v4
with:
name: openpulse-python-sdist
- name: Verify package
run: |
set -e
python3 -mvenv .venv
source .venv/bin/activate
python3 -mpip install -U pip wheel
python3 -mpip install openpulse-*.whl
# Extract the version information from the end of the tag.
tag_version=${GITHUB_REF#refs/tags/v}
# We could get this from the wheel filename too, but it's easier to
# test with Python built-ins.
wheel_version=$(python3 -c 'from importlib.metadata import version; print(version("openpulse"))')
if [[ "$tag_version" != "$wheel_version" ]]; then
echo "Version mismatch: tag says '$tag_version', wheel says '$wheel_version'" >&2
exit 1
fi
# Last-ditch validity check that the wheel actually imports.
python3 -c 'import openpulse'
- name: Upload to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.OPENQASM_BOT_PYPI_TOKEN }}
run: |
set -e
source .venv/bin/activate
python3 -mpip install -U twine
twine upload openpulse-*.whl openpulse-*.tar.gz