-
Notifications
You must be signed in to change notification settings - Fork 0
158 lines (138 loc) · 3.89 KB
/
release.yml
File metadata and controls
158 lines (138 loc) · 3.89 KB
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
name: release
on:
push:
branches: [release]
tags: [v*]
workflow_dispatch:
inputs:
pkgcraft-c-ref:
required: false
type: string
default: 'main'
jobs:
setup:
runs-on: ubuntu-latest
outputs:
pkgcraft-c-ref: ${{ steps.vars.outputs.pkgcraft-c-ref }}
steps:
- name: Checkout pkgcraft code
uses: actions/checkout@v4
with:
repository: pkgcraft/pkgcraft
# checkout full history for tags
fetch-depth: 0
submodules: true
- name: Determine target pkgcraft-c version
id: vars
run: |
if [[ -n "${{ inputs.pkgcraft-c-ref }}" ]]; then
pkgcraft_c_ref=${{ inputs.pkgcraft-c-ref }}
else
# get all pkgcraft-c tags in descending time created order
mapfile -t tags < <( git tag --list --sort=-taggerdate 'pkgcraft-c-*' )
pkgcraft_c_ref=${tags[0]}
if [[ -z ${pkgcraft_c_ref} ]]; then
echo "No tags matching: pkgcraft-c-*"
exit 1
fi
fi
if [[ ${pkgcraft_c_ref} =~ ^pkgcraft-c-* ]]; then
echo "Building against pkgcraft-c tag: ${pkgcraft_c_ref}"
else
echo "Building against pkgcraft-c branch: ${pkgcraft_c_ref}"
fi
echo "pkgcraft-c-ref=${pkgcraft_c_ref}" >> $GITHUB_OUTPUT
build-sdist:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# checkout full history for setuptools-scm
fetch-depth: 0
submodules: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Build sdist
run: |
pip install tox
tox -e sdist
- name: Upload sdist artifact
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
if-no-files-found: error
retention-days: 3
build-wheels:
needs: ["build-sdist", "setup"]
strategy:
matrix:
include:
- os: ubuntu-latest
arch: 'x86_64'
- os: ubuntu-latest
arch: 'aarch64'
- os: ubuntu-latest
arch: 'ppc64le'
runs-on: ${{ matrix.os }}
env:
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macos-target }}
CIBW_CONTAINER_ENGINE: 'docker'
CIBW_PLATFORM: 'auto'
PKGCRAFT_C_REF: ${{ needs.setup.outputs.pkgcraft-c-ref }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Download sdist artifact
uses: actions/download-artifact@v4
with:
name: sdist
path: dist
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Set up QEMU
if: runner.os == 'Linux' && matrix.arch != 'x86_64'
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ matrix.arch }}
- name: Build wheels
run: .ci/build-wheels ${{ matrix.arch }}
- name: Verify wheels
run: |
pip install twine
twine check wheels/*
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.arch }}-wheels
path: wheels/
if-no-files-found: error
retention-days: 3
publish:
if: startsWith(github.ref, 'refs/tags/')
needs: ["build-sdist", "build-wheels"]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Upload files to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: artifacts
print-hash: true
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
files: artifacts/*.tar.gz
fail_on_unmatched_files: true