-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Load ANTLR files based on dynamic runtime version * Add missing files * Added deploy-ast.yml * Incorporated a couple of jakelishman PR feedbacks * Added deploy action * Removed testpypi after testing
- Loading branch information
1 parent
99b6b4d
commit 40712b6
Showing
2 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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@v3 | ||
with: | ||
name: openpulse-python-wheel | ||
|
||
- uses: actions/download-artifact@v3 | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters