Skip to content

Merge pull request #1343 from pganssle/release_2.9.0 #12

Merge pull request #1343 from pganssle/release_2.9.0

Merge pull request #1343 from pganssle/release_2.9.0 #12

Workflow file for this run

# This workflow is triggered three ways:
#
# 1. Manually triggering the workflow via the GitHub UI (Actions > Upload
# package) will upload to test.pypi.org without the need to create a tag.
# 2. When a tag is created, the workflow will upload the package to
# test.pypi.org.
# 3. When a GitHub Release is made, the workflow will upload the package to pypi.org.
#
# It is done this way until PyPI has draft reviews, to allow for a two-stage
# upload with a chance for manual intervention before the final publication.
name: Upload package
on:
release:
types: [created]
push:
tags:
- '*'
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: Run updatezinfo.py (Unix)
run: |
python -m venv venv
venv/bin/pip install -e .
./ci_tools/retry.sh venv/bin/python updatezinfo.py
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U tox
- name: Create tox environments
run: |
tox -p -e py,build,release --notest
- name: Run tests
run: |
tox -e py
- name: Build package
run: |
tox -e build
- name: Publish package
env:
TWINE_USERNAME: "__token__"
run: |
if [[ "$GITHUB_EVENT_NAME" == "push" || \
"$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then
export TWINE_REPOSITORY_URL="https://test.pypi.org/legacy/"
export TWINE_PASSWORD="${{ secrets.TEST_PYPI_UPLOAD_TOKEN }}"
elif [[ "$GITHUB_EVENT_NAME" == "release" ]]; then
export TWINE_REPOSITORY="pypi"
export TWINE_PASSWORD="${{ secrets.PYPI_UPLOAD_TOKEN }}"
else
echo "Unknown event name: ${GITHUB_EVENT_NAME}"
exit 1
fi
tox -e release