-
Notifications
You must be signed in to change notification settings - Fork 0
162 lines (131 loc) · 3.83 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
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
159
160
161
162
name: Release
on:
push:
tags: ["v*"]
env:
GH_TOKEN: ${{ github.token }}
permissions: write-all
jobs:
prepare:
runs-on: windows-latest
steps:
- name: Validate push
if: github.event.commits[1] != null
run: echo "::error title=Invalid push::The release push much include only the tagged commit!"
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install Dependencies
run: pip install -r requirements.txt
- name: Codegen
run: python gen_all.py
working-directory: codegen
- name: Cythonize
shell: pwsh
run: |
foreach ($file in (Get-ChildItem src/gdmath/*.pyx)) {
cython "$($file.FullName)"
}
- name: Copy outputs to src
run: copy "codegen\output\*" "src\gdmath"
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: codegen_results
path: codegen/output/
retention-days: 1
- name: Create Release
run: gh release create "${{ github.ref_name }}" --verify-tag --title "${{ github.ref_name }}" --notes "${{ github.event.head_commit.message }}" --draft
source_dists:
runs-on: windows-latest
needs: prepare
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Codegen Output
uses: actions/download-artifact@v3
with:
name: codegen_results
path: src/gdmath
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install Dependencies
run: pip install -r requirements.txt
- name: Build
run: python setup.py sdist --formats=gztar,zip
- name: Upload
shell: pwsh
run: |
foreach ($file in (Get-ChildItem dist/*)) {
gh release upload "${{ github.ref_name }}" "$($file.FullName)"
}
- name: Upload to Artifacts
uses: actions/upload-artifact@v3
with:
name: dists
path: dist/
binary_dists:
runs-on: ${{ matrix.platform }}
needs: prepare
strategy:
fail-fast: true
matrix:
python: ["cp39", "cp310", "cp311", "cp312", "pp39", "pp310"]
platform: ["windows-latest", "ubuntu-latest", "macos-latest"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Codegen Output
uses: actions/download-artifact@v3
with:
name: codegen_results
path: src/gdmath
- name: CIBuildWheel
uses: pypa/[email protected]
with:
output-dir: dist
env:
CIBW_BUILD: "${{ matrix.python }}-*"
# - name: Upload
# shell: pwsh
# run: |
# foreach ($file in (Get-ChildItem dist/*)) {
# gh release upload "${{ github.ref_name }}" "$($file.FullName)"
# }
- name: Upload to Artifacts
uses: actions/upload-artifact@v3
with:
name: dists
path: dist/
final_publish:
runs-on: ubuntu-latest
needs: [source_dists, binary_dists]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Publish
run: gh release edit ${{ github.ref_name }} --draft=false
pypi_publish:
runs-on: ubuntu-latest
needs: final_publish
permissions:
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- run: mkdir dist
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: dists
path: dist
- name: Delete redundant sdists
shell: pwsh
run: rm dist/*.zip
- name: Upload
uses: pypa/[email protected]