-
Notifications
You must be signed in to change notification settings - Fork 3
191 lines (169 loc) · 5.25 KB
/
release.yml
File metadata and controls
191 lines (169 loc) · 5.25 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
---
name: Release
on:
push:
tags:
- "v*"
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
build:
name: Build distribution
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Set up Python
run: uv python install 3.13
- name: Build package
run: uv build
- name: Upload distribution artifacts
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
build-executables:
name: Build ${{ matrix.os }} ${{ matrix.arch }} executable
runs-on: ${{ matrix.runner }}
permissions:
id-token: write
contents: read
strategy:
fail-fast: false
matrix:
include:
# AMD64 builds
- os: linux
arch: amd64
runner: ubuntu-latest
artifact_name: phabfive
asset_name: phabfive-linux-amd64
- os: macos
arch: amd64
runner: macos-14
artifact_name: phabfive
asset_name: phabfive-macos-amd64
- os: windows
arch: amd64
runner: windows-latest
artifact_name: phabfive.exe
asset_name: phabfive-windows-amd64.exe
# ARM64 builds
- os: linux
arch: arm64
runner: ubuntu-24.04-arm
artifact_name: phabfive
asset_name: phabfive-linux-arm64
- os: macos
arch: arm64
runner: macos-latest
artifact_name: phabfive
asset_name: phabfive-macos-arm64
- os: windows
arch: arm64
runner: windows-11-arm
artifact_name: phabfive.exe
asset_name: phabfive-windows-arm64.exe
skip_signing: true
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Cosign
if: ${{ !matrix.skip_signing }}
uses: sigstore/cosign-installer@v3
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller
pip install .
- name: Build executable
shell: bash
run: |
pyinstaller --onefile --name phabfive phabfive/cli.py \
--collect-data rich \
--copy-metadata rich \
--collect-data phabricator \
--hidden-import phabricator \
--hidden-import anyconfig.backend.yaml \
--exclude-module mkdocs
- name: Rename artifact
shell: bash
run: mv dist/${{ matrix.artifact_name }} dist/${{ matrix.asset_name }}
- name: Sign executable with Sigstore
if: ${{ !matrix.skip_signing }}
shell: bash
run: |
cosign sign-blob dist/${{ matrix.asset_name }} \
--bundle dist/${{ matrix.asset_name }}.sigstore.json \
--yes
- name: Upload executable and signature
if: ${{ !matrix.skip_signing }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}
path: |
dist/${{ matrix.asset_name }}
dist/${{ matrix.asset_name }}.sigstore.json
- name: Upload executable (unsigned)
if: ${{ matrix.skip_signing }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}
path: dist/${{ matrix.asset_name }}
publish-pypi:
name: Publish to PyPI
needs: build
if: ${{ !contains(github.ref_name, '-rc') }}
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/phabfive
permissions:
id-token: write
steps:
- name: Download distribution artifacts
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
github-release:
name: Create GitHub Release
needs: [build, publish-pypi, build-executables]
if: ${{ always() && needs.build.result == 'success' && needs.build-executables.result == 'success' && (needs.publish-pypi.result == 'success' || needs.publish-pypi.result == 'skipped') }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts/
- name: Prepare release assets
run: |
mkdir -p release-assets
# Copy Python distributions
cp artifacts/python-package-distributions/* release-assets/
# Copy executables
for dir in artifacts/phabfive-*/; do
cp "$dir"* release-assets/ 2>/dev/null || true
done
ls -la release-assets/
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
release-assets/*