-
Notifications
You must be signed in to change notification settings - Fork 1
122 lines (121 loc) · 4.08 KB
/
release.yml
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
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 == 'jsirois' }}
runs-on: ubuntu-22.04
steps:
- name: Noop
run: "true"
determine-tag:
name: Determine the release tag to operate against.
needs: org-check
runs-on: ubuntu-22.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-dists:
name: Package Distributions for Python 3.6
needs: determine-tag
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-12]
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 3.6
uses: gabrielfalcao/pyenv-action@v18
env:
ENSUREPIP: no
with:
default: "3.6.15"
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 }}-3.6-distributions"
path: dist/
retention-days: 1
package-37-312-dists:
name: Package Distributions for Python 3.7 - 3.13
needs: determine-tag
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-12, windows-2022]
python-version: [[3, 7], [3, 8], [3, 9], [3, 10], [3, 11], [3, 12], [3, 13, "0-alpha.2"]]
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-dists
- package-37-313-dists
runs-on: ubuntu-22.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-22.04-${{ needs.determine-tag.outputs.release-tag }}-3.12-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