Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update release workflow #202

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 11 additions & 34 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,37 @@
name: release

on:
workflow_call:
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#onworkflow_callinputs
inputs:
pypi:
description: Publish to PyPI registry
default: false
required: false
type: boolean
secrets:
pypi_password:
description: "API token for pypi.org"
required: true
testpypi_password:
description: "API token for test.pypi.org"
required: true
release:
types: [published]

jobs:
pypi:
name: Publish to PyPI registry
if: "${{ inputs.pypi }}"
release:
name: release ${{ github.event.ref }}
environment: release
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
permissions:
id-token: write

env:
FORCE_COLOR: 1
PY_COLORS: 1
TOXENV: packaging
TOX_PARALLEL_NO_SPINNER: 1

steps:
- name: Switch to using Python 3.8 by default
- name: Switch to using Python 3.12 by default
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: "3.12"

- name: Install tox
run: >-
python3 -m pip install --user tox
run: python3 -m pip install --user "tox>=4.0.0"

- name: Check out src from Git
uses: actions/checkout@v4
with:
fetch-depth: 0 # needed by setuptools-scm

- name: Build dists
run: python3 -m tox

- name: Publish to test.pypi.org
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.testpypi_password }}
repository_url: https://test.pypi.org/legacy/

run: python3 -m tox -e pkg
- name: Publish to pypi.org
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.pypi_password }}