-
Notifications
You must be signed in to change notification settings - Fork 2
217 lines (185 loc) · 6.16 KB
/
release.yml
File metadata and controls
217 lines (185 loc) · 6.16 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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
name: Build Release Binaries
on:
release:
types: [created]
workflow_dispatch:
inputs:
tag:
description: 'Release tag (e.g., v0.0.1)'
required: true
permissions:
contents: write
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: macos-15
platform: darwin-arm64
- os: macos-15-large
platform: darwin-x64
- os: ubuntu-22.04
platform: linux-x64
- os: ubuntu-22.04-arm
platform: linux-arm64
- os: windows-latest
platform: windows-x64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Install dependencies
run: uv sync --extra cli && uv pip install pyinstaller>=6.0.0
- name: Get version
id: version
shell: bash
run: |
VERSION=$(grep '^version' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Build binary
run: uv run python scripts/build.py --skip-deps
- name: List build output
shell: bash
run: |
echo "Build output:"
ls -la dist/
echo ""
echo "Archive contents:"
if [ -f "dist/parallel-cli-${{ matrix.platform }}.zip" ]; then
unzip -l "dist/parallel-cli-${{ matrix.platform }}.zip" | head -20 || true
fi
- name: Verify checksum file exists
shell: bash
run: |
if [ ! -f "dist/parallel-cli-${{ matrix.platform }}.zip.sha256" ]; then
echo "Error: Checksum file not found"
exit 1
fi
echo "Checksum: $(cat dist/parallel-cli-${{ matrix.platform }}.zip.sha256)"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: binary-${{ matrix.platform }}
path: |
dist/parallel-cli-${{ matrix.platform }}.zip
dist/parallel-cli-${{ matrix.platform }}.zip.sha256
retention-days: 1
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: binary-*
merge-multiple: true
- name: Copy install script to artifacts
run: cp install-cli.sh artifacts/install.sh
- name: List artifacts
run: |
echo "Downloaded artifacts:"
ls -la artifacts/
- name: Upload to Release
uses: softprops/action-gh-release@v2
with:
files: artifacts/*
tag_name: ${{ github.event.release.tag_name || github.event.inputs.tag }}
publish-npm:
needs: release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
- name: Get version from tag
id: version
env:
TAG: ${{ github.event.release.tag_name || github.event.inputs.tag }}
run: |
VERSION="${TAG#v}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Update package.json version
working-directory: npm
env:
VERSION: ${{ steps.version.outputs.version }}
run: npm version "$VERSION" --no-git-tag-version --allow-same-version
- name: Publish to npm
working-directory: npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
publish-homebrew:
needs: release
runs-on: ubuntu-latest
# Skip for pre-release versions (RCs)
if: ${{ !contains(github.event.release.tag_name || github.event.inputs.tag, 'rc') }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Get version from tag
id: version
env:
TAG: ${{ github.event.release.tag_name || github.event.inputs.tag }}
run: |
VERSION="${TAG#v}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Download checksum files from release
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.event.release.tag_name || github.event.inputs.tag }}
run: |
mkdir -p checksums
for platform in darwin-arm64 darwin-x64; do
gh release download "$TAG" \
--pattern "parallel-cli-${platform}.zip.sha256" \
--dir checksums || echo "Warning: No checksum for ${platform}"
done
echo "Downloaded checksums:"
ls -la checksums/
- name: Generate Homebrew cask
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
python scripts/update-homebrew-formula.py \
--version "$VERSION" \
--checksums-dir checksums \
--output cask/parallel-cli.rb
echo "Generated cask:"
cat cask/parallel-cli.rb
- name: Push cask to Homebrew tap
env:
TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
VERSION: ${{ steps.version.outputs.version }}
run: |
git clone https://x-access-token:${TAP_TOKEN}@github.com/parallel-web/homebrew-tap.git tap-repo
mkdir -p tap-repo/Casks
cp cask/parallel-cli.rb tap-repo/Casks/parallel-cli.rb
cd tap-repo
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Casks/parallel-cli.rb
if git diff --cached --quiet; then
echo "No changes to cask"
else
git commit -m "Update parallel-cli to ${VERSION}"
git push origin main
echo "Cask updated successfully"
fi