-
Notifications
You must be signed in to change notification settings - Fork 2
68 lines (68 loc) · 2.1 KB
/
python_release.yaml
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
# Reusable workflow for the repositories of the Arcalot organization.
# This workflow builds a Python "wheel" for distributing the package.
# It requires the PYPI_TOKEN secret.
# (It is only run when invoked by another workflow.)
on:
workflow_call:
inputs:
python_version:
required: true
type: string
secrets:
PYPI_TOKEN:
required: true
jobs:
build_python_wheel:
name: build python wheel
runs-on: ubuntu-latest
steps:
- name: version format check
if: startsWith(github.event.ref, 'refs/tags/')
shell: bash
env:
VERSION: ${{ github.ref_name }}
run: |
if [[ ${VERSION//[[:blank:]]/} =~ ^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+(-[[:alnum:].-]+)?(\+[[:alnum:].-]+)?$ ]]
then echo "[INF] version format accepted"
else echo "[ERR] wrong version format: $VERSION" ; exit 1
fi
- name: Check out code
uses: actions/checkout@v4
- name: Download binaries
uses: actions/download-artifact@v4
with:
name: binaries
path: python/artifacts
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python_version }}
architecture: 'x64'
- name: Grab the License file
run: |
cp LICENSE python/
- name: Fetch python dependencies
working-directory: python
shell: bash
run: |
make setup
- name: Bump version
if: startsWith(github.event.ref, 'refs/tags/')
working-directory: python
env:
VERSION: ${{ github.ref_name }}
shell: bash
run: |
sed -ri "s/^(.+version=')(.+)('.*)$/\1${VERSION/v/}\3/" setup.py
- name: Build python wheel
working-directory: python
run: |
make all
- name: Push to pypi
if: startsWith(github.event.ref, 'refs/tags/')
working-directory: python
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
twine upload dist/*