-
Notifications
You must be signed in to change notification settings - Fork 0
191 lines (172 loc) · 5.78 KB
/
Copy pathprerelease.yml
File metadata and controls
191 lines (172 loc) · 5.78 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: Create Prerelease on PR Ready
on:
pull_request:
branches:
- main
types:
- ready_for_review
paths:
- '.github/workflows/prerelease.yml'
- '.github/scripts/**'
- '**.swift'
- '**.png'
- 'Contents.json'
- 'Jot.xcodeproj.zip'
- 'cross-platform/**'
jobs:
cross-platform-build:
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
# Pin runner images for reproducibility; update only after verifying builds.
matrix:
os: [ubuntu-22.04, windows-2022, macos-14]
needs: []
steps:
- uses: actions/checkout@v4
- name: Export app version
shell: bash
run: |
printf "APP_VERSION=%s\n" "$(node -p "require('./cross-platform/package.json').version")" >> "$GITHUB_ENV"
- name: Install Linux dependencies
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y \
libgtk-3-dev \
libwebkit2gtk-4.0-dev \
libjavascriptcoregtk-4.0-dev \
libayatana-appindicator3-dev \
librsvg2-dev \
libsoup2.4-dev \
build-essential \
curl \
wget \
libssl-dev \
patchelf \
pkg-config
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install JS dependencies
working-directory: cross-platform
run: npm ci
- name: Generate Tauri icons
working-directory: cross-platform
run: npx tauri icon ../JotIcon-iOS-Default-1024x1024@1x.png
- name: Build cross-platform app
working-directory: cross-platform
shell: bash
run: |
case "${{ runner.os }}" in
Windows)
npm run tauri -- build --bundles nsis,msi --verbose
;;
Linux)
npm run tauri -- build --bundles appimage --verbose
;;
macOS)
npm run tauri -- build --bundles app --verbose
;;
*)
echo "Unsupported runner OS: ${{ runner.os }}"
exit 1
;;
esac
- name: Package macOS app bundle
if: matrix.os == 'macos-14'
run: |
APP_PATH="cross-platform/src-tauri/target/release/bundle/macos/PinStick.app"
if [ ! -d "$APP_PATH" ]; then
echo "Missing macOS app at $APP_PATH"
exit 1
fi
ditto -c -k --sequesterRsrc --keepParent "$APP_PATH" "PinStick-${APP_VERSION}-macOS.app.zip"
- name: Collect Windows installer
if: matrix.os == 'windows-2022'
shell: bash
run: |
shopt -s nullglob globstar
release_dir="cross-platform/src-tauri/target/release"
bundle_dir="$release_dir/bundle"
msi_candidates=(
"$bundle_dir"/**/*.msi
)
portable_candidates=(
"$release_dir"/*.exe
)
artifact_dir="PinStick-${APP_VERSION}-windows"
mkdir -p "$artifact_dir"
if [ ${#msi_candidates[@]} -eq 0 ] || [ ${#portable_candidates[@]} -eq 0 ]; then
echo "Expected MSI installer under $bundle_dir and portable EXE under $release_dir"
if [ -d "$release_dir" ]; then
find "$release_dir" -maxdepth 4 -type f | sort
else
echo "Release directory missing: $release_dir"
fi
exit 1
fi
cp "${msi_candidates[0]}" "$artifact_dir/PinStick-install.msi"
cp "${portable_candidates[0]}" "$artifact_dir/PinStick-portable.exe"
printf "WINDOWS_ARTIFACT_DIR=%s\n" "$artifact_dir" >> "$GITHUB_ENV"
- name: Collect Linux AppImage
if: matrix.os == 'ubuntu-22.04'
run: |
shopt -s nullglob
src=(cross-platform/src-tauri/target/release/bundle/appimage/*.AppImage)
if [ ${#src[@]} -eq 0 ]; then
echo "No AppImage found"
exit 1
fi
cp "${src[0]}" "PinStick-${APP_VERSION}-linux.AppImage"
- name: Upload macOS artifact
if: matrix.os == 'macos-14'
uses: actions/upload-artifact@v4
with:
name: PinStick-macos
path: PinStick-${{ env.APP_VERSION }}-macOS.app.zip
if-no-files-found: error
- name: Upload Windows artifact
if: matrix.os == 'windows-2022'
uses: actions/upload-artifact@v4
with:
name: PinStick-windows
path: ${{ env.WINDOWS_ARTIFACT_DIR }}
if-no-files-found: error
- name: Upload Linux artifact
if: matrix.os == 'ubuntu-22.04'
uses: actions/upload-artifact@v4
with:
name: PinStick-linux
path: PinStick-${{ env.APP_VERSION }}-linux.AppImage
if-no-files-found: error
prerelease:
needs: cross-platform-build
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Export app version
shell: bash
run: |
printf "APP_VERSION=%s\n" "$(node -p "require('./cross-platform/package.json').version")" >> "$GITHUB_ENV"
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create prerelease
uses: softprops/action-gh-release@v1
with:
tag_name: prerelease-${{ github.run_id }}
name: "PinStick v${{ env.APP_VERSION }} prerelease (run ${{ github.run_id }})"
draft: false
prerelease: true
files: |
artifacts/PinStick-macos/*
artifacts/PinStick-windows/*
artifacts/PinStick-linux/*