Skip to content

Commit a0a8807

Browse files
committed
fix: use tauri-action built-in updater JSON generation
1 parent 55e9900 commit a0a8807

File tree

1 file changed

+3
-159
lines changed

1 file changed

+3
-159
lines changed

.github/workflows/tauri-build.yml

Lines changed: 3 additions & 159 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ jobs:
9999
run: npm test
100100

101101
- name: Build Tauri App
102+
id: tauri-build
102103
uses: tauri-apps/tauri-action@v0
103104
env:
104105
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -117,164 +118,7 @@ jobs:
117118
The app will automatically check for updates.
118119
releaseDraft: true
119120
prerelease: false
120-
includeUpdaterJson: false
121+
includeUpdaterJson: true
122+
updaterJsonPreferNsis: true
121123
args: ${{ matrix.args }}
122124

123-
- name: Find and upload updater files to release
124-
if: startsWith(github.ref, 'refs/tags/v')
125-
shell: bash
126-
env:
127-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
128-
run: |
129-
VERSION="${GITHUB_REF_NAME#v}"
130-
131-
echo "Looking for updater files (.sig, .tar.gz, .zip)..."
132-
find src-tauri/target -name "*.sig" -type f 2>/dev/null | head -20
133-
find src-tauri/target -name "*.tar.gz" -type f 2>/dev/null | head -20
134-
find src-tauri/target -name "*.nsis.zip" -type f 2>/dev/null | head -20
135-
136-
# Upload based on platform
137-
if [ "${{ matrix.artifact_name }}" = "macos-aarch64" ]; then
138-
SIG_FILE=$(find src-tauri/target -name "*.app.tar.gz.sig" -type f 2>/dev/null | head -1)
139-
if [ -n "$SIG_FILE" ]; then
140-
cp "$SIG_FILE" "msgReader_aarch64.app.tar.gz.sig"
141-
gh release upload "${{ github.ref_name }}" "msgReader_aarch64.app.tar.gz.sig" --clobber
142-
echo "Uploaded: msgReader_aarch64.app.tar.gz.sig"
143-
fi
144-
145-
elif [ "${{ matrix.artifact_name }}" = "macos-x64" ]; then
146-
SIG_FILE=$(find src-tauri/target -name "*.app.tar.gz.sig" -type f 2>/dev/null | head -1)
147-
if [ -n "$SIG_FILE" ]; then
148-
cp "$SIG_FILE" "msgReader_x64.app.tar.gz.sig"
149-
gh release upload "${{ github.ref_name }}" "msgReader_x64.app.tar.gz.sig" --clobber
150-
echo "Uploaded: msgReader_x64.app.tar.gz.sig"
151-
fi
152-
153-
elif [ "${{ matrix.artifact_name }}" = "linux" ]; then
154-
# Upload AppImage.tar.gz bundle
155-
BUNDLE_FILE=$(find src-tauri/target -name "*.AppImage.tar.gz" -type f 2>/dev/null | head -1)
156-
if [ -n "$BUNDLE_FILE" ]; then
157-
cp "$BUNDLE_FILE" "msgReader_${VERSION}_amd64.AppImage.tar.gz"
158-
gh release upload "${{ github.ref_name }}" "msgReader_${VERSION}_amd64.AppImage.tar.gz" --clobber
159-
echo "Uploaded: msgReader_${VERSION}_amd64.AppImage.tar.gz"
160-
fi
161-
# Upload signature
162-
SIG_FILE=$(find src-tauri/target -name "*.AppImage.tar.gz.sig" -type f 2>/dev/null | head -1)
163-
if [ -n "$SIG_FILE" ]; then
164-
cp "$SIG_FILE" "msgReader_${VERSION}_amd64.AppImage.tar.gz.sig"
165-
gh release upload "${{ github.ref_name }}" "msgReader_${VERSION}_amd64.AppImage.tar.gz.sig" --clobber
166-
echo "Uploaded: msgReader_${VERSION}_amd64.AppImage.tar.gz.sig"
167-
fi
168-
169-
elif [ "${{ matrix.artifact_name }}" = "windows" ]; then
170-
# Upload nsis.zip bundle
171-
BUNDLE_FILE=$(find src-tauri/target -name "*.nsis.zip" -type f 2>/dev/null | head -1)
172-
if [ -n "$BUNDLE_FILE" ]; then
173-
cp "$BUNDLE_FILE" "msgReader_${VERSION}_x64-setup.nsis.zip"
174-
gh release upload "${{ github.ref_name }}" "msgReader_${VERSION}_x64-setup.nsis.zip" --clobber
175-
echo "Uploaded: msgReader_${VERSION}_x64-setup.nsis.zip"
176-
fi
177-
# Upload signature
178-
SIG_FILE=$(find src-tauri/target -name "*.nsis.zip.sig" -type f 2>/dev/null | head -1)
179-
if [ -n "$SIG_FILE" ]; then
180-
cp "$SIG_FILE" "msgReader_${VERSION}_x64-setup.nsis.zip.sig"
181-
gh release upload "${{ github.ref_name }}" "msgReader_${VERSION}_x64-setup.nsis.zip.sig" --clobber
182-
echo "Uploaded: msgReader_${VERSION}_x64-setup.nsis.zip.sig"
183-
fi
184-
fi
185-
186-
create-updater-json:
187-
needs: build
188-
runs-on: ubuntu-latest
189-
if: startsWith(github.ref, 'refs/tags/v')
190-
191-
steps:
192-
- name: Download signature files from release
193-
env:
194-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
195-
run: |
196-
VERSION="${GITHUB_REF_NAME#v}"
197-
TAG_NAME="${GITHUB_REF_NAME}"
198-
BASE_URL="https://github.com/${{ github.repository }}/releases/download/${TAG_NAME}"
199-
200-
mkdir -p signatures
201-
202-
echo "Downloading signature files from release..."
203-
204-
# Download each signature file (may not all exist yet, that's ok)
205-
curl -sL -o signatures/macos-aarch64.sig "${BASE_URL}/msgReader_aarch64.app.tar.gz.sig" || true
206-
curl -sL -o signatures/macos-x64.sig "${BASE_URL}/msgReader_x64.app.tar.gz.sig" || true
207-
curl -sL -o signatures/linux.sig "${BASE_URL}/msgReader_${VERSION}_amd64.AppImage.tar.gz.sig" || true
208-
curl -sL -o signatures/windows.sig "${BASE_URL}/msgReader_${VERSION}_x64-setup.nsis.zip.sig" || true
209-
210-
echo "Downloaded files:"
211-
ls -la signatures/
212-
213-
- name: Create latest.json
214-
env:
215-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
216-
run: |
217-
VERSION="${GITHUB_REF_NAME#v}"
218-
TAG_NAME="${GITHUB_REF_NAME}"
219-
220-
# Read signatures from downloaded files
221-
# Check if file exists and is not an HTML error page
222-
read_sig() {
223-
if [ -f "$1" ] && ! grep -q "<!DOCTYPE" "$1" 2>/dev/null; then
224-
cat "$1"
225-
else
226-
echo ""
227-
fi
228-
}
229-
230-
export SIG_MACOS_AARCH64=$(read_sig signatures/macos-aarch64.sig)
231-
export SIG_MACOS_X64=$(read_sig signatures/macos-x64.sig)
232-
export SIG_LINUX=$(read_sig signatures/linux.sig)
233-
export SIG_WINDOWS=$(read_sig signatures/windows.sig)
234-
235-
echo "Signatures found:"
236-
echo " macOS aarch64: ${SIG_MACOS_AARCH64:0:50}..."
237-
echo " macOS x64: ${SIG_MACOS_X64:0:50}..."
238-
echo " Linux: ${SIG_LINUX:0:50}..."
239-
echo " Windows: ${SIG_WINDOWS:0:50}..."
240-
241-
# Base URL for downloads
242-
BASE_URL="https://github.com/${{ github.repository }}/releases/download/${TAG_NAME}"
243-
244-
# Create latest.json using node for proper JSON formatting
245-
node -e "
246-
const fs = require('fs');
247-
const json = {
248-
version: '${VERSION}',
249-
notes: 'See release notes at ' + '${BASE_URL}',
250-
pub_date: new Date().toISOString(),
251-
platforms: {
252-
'darwin-aarch64': {
253-
signature: process.env.SIG_MACOS_AARCH64 || '',
254-
url: '${BASE_URL}/msgReader_aarch64.app.tar.gz'
255-
},
256-
'darwin-x86_64': {
257-
signature: process.env.SIG_MACOS_X64 || '',
258-
url: '${BASE_URL}/msgReader_x64.app.tar.gz'
259-
},
260-
'linux-x86_64': {
261-
signature: process.env.SIG_LINUX || '',
262-
url: '${BASE_URL}/msgReader_${VERSION}_amd64.AppImage.tar.gz'
263-
},
264-
'windows-x86_64': {
265-
signature: process.env.SIG_WINDOWS || '',
266-
url: '${BASE_URL}/msgReader_${VERSION}_x64-setup.nsis.zip'
267-
}
268-
}
269-
};
270-
fs.writeFileSync('latest.json', JSON.stringify(json, null, 2));
271-
"
272-
273-
echo "Created latest.json:"
274-
cat latest.json
275-
276-
- name: Upload latest.json to release
277-
env:
278-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
279-
run: |
280-
gh release upload "${{ github.ref_name }}" latest.json --repo "${{ github.repository }}" --clobber

0 commit comments

Comments
 (0)