Prep PI support. (#7) #18
Workflow file for this run
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
name: Release | |
on: | |
push: | |
tags: | |
- v[0-9]+.[0-9]+.[0-9]+ | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: The tag to manually run a deploy for. | |
required: true | |
jobs: | |
org-check: | |
name: Check GitHub Organization | |
if: ${{ github.repository_owner == 'pex-tool' }} | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Noop | |
run: "true" | |
determine-tag: | |
name: Determine the release tag to operate against. | |
needs: org-check | |
runs-on: ubuntu-24.04 | |
outputs: | |
release-tag: ${{ steps.determine-tag.outputs.release-tag }} | |
release-version: ${{ steps.determine-tag.outputs.release-version }} | |
steps: | |
- name: Determine Tag | |
id: determine-tag | |
run: | | |
if [[ -n "${{ github.event.inputs.tag }}" ]]; then | |
RELEASE_TAG=${{ github.event.inputs.tag }} | |
else | |
RELEASE_TAG=${GITHUB_REF#refs/tags/} | |
fi | |
if [[ "${RELEASE_TAG}" =~ ^v[0-9]+.[0-9]+.[0-9]+$ ]]; then | |
echo "release-tag=${RELEASE_TAG}" >> $GITHUB_OUTPUT | |
echo "release-version=${RELEASE_TAG#v}" >> $GITHUB_OUTPUT | |
else | |
echo "::error::Release tag '${RELEASE_TAG}' must match 'v\d+.\d+.\d+'." | |
exit 1 | |
fi | |
package-36-38-dists: | |
name: Package Distributions for Python 3.6 - 3.8 | |
needs: determine-tag | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-24.04, macos-13] | |
python-version: [[3, 6, 15], [3, 7, 17], [3, 8, 18]] | |
steps: | |
- name: Checkout p537 ${{ needs.determine-tag.outputs.release-tag }} | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ needs.determine-tag.outputs.release-tag }} | |
- name: "Setup Python ${{ join(matrix.python-version, '.') }}" | |
# Upgrade node16 -> node20: Out for review here: | |
# https://github.com/gabrielfalcao/pyenv-action/pull/444 | |
uses: pex-tool/pyenv-action@baec18679698d2f80064cc04eb9ad0c8dc5ca8f8 | |
env: | |
ENSUREPIP: no | |
with: | |
default: "${{ join(matrix.python-version, '.') }}" | |
command: pip install -U tox | |
- name: Package ${{ needs.determine-tag.outputs.release-tag }} | |
run: tox -e package | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "${{ matrix.os }}-${{ needs.determine-tag.outputs.release-tag }}-${{ join(matrix.python-version, '.') }}-distributions" | |
path: dist/ | |
retention-days: 1 | |
package-39-314-dists: | |
name: Package Distributions for Python ${{ matrix.python-version[0] }}${{ matrix.python-version[1] }} | |
needs: determine-tag | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-24.04, macos-13, windows-2022] | |
python-version: [[3, 9], [3, 10], [3, 11], [3, 12], [3, 13], [3, 14, "0-alpha.1"]] | |
steps: | |
- name: Checkout p537 ${{ needs.determine-tag.outputs.release-tag }} | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ needs.determine-tag.outputs.release-tag }} | |
- name: Setup Python ${{ join(matrix.python-version, '.') }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "${{ join(matrix.python-version, '.') }}" | |
- name: Package ${{ needs.determine-tag.outputs.release-tag }} | |
uses: pantsbuild/actions/run-tox@b16b9cf47cd566acfe217b1dafc5b452e27e6fd7 | |
with: | |
tox-env: package | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "${{ matrix.os }}-${{ needs.determine-tag.outputs.release-tag }}-${{ join(matrix.python-version, '.') }}-distributions" | |
path: dist/ | |
retention-days: 1 | |
pypi: | |
name: Publish sdist and wheel to PyPI | |
needs: | |
- determine-tag | |
- package-36-38-dists | |
- package-39-314-dists | |
runs-on: ubuntu-24.04 | |
environment: Release | |
permissions: | |
id-token: write | |
steps: | |
- name: Download all packaged distributions | |
uses: actions/download-artifact@v4 | |
with: | |
path: dist/ | |
- name: Re-organize distributions for upload | |
run: | | |
mv -v dist/ubuntu-24.04-${{ needs.determine-tag.outputs.release-tag }}-3.13-distributions/*.tar.gz dist/ | |
mv -v dist/*-distributions/*.whl dist/ | |
rm -rf dist/*-distributions | |
- name: Publish p537 ${{ needs.determine-tag.outputs.release-tag }} | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
skip-existing: true | |
print-hash: true | |
verbose: true | |