Skip to content

Commit b2dffc9

Browse files
committed
Update blockmaps
1 parent 1619f91 commit b2dffc9

6 files changed

Lines changed: 97 additions & 132 deletions

File tree

.github/workflows/build-and-release.yml

Lines changed: 88 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ jobs:
3838
id: package-version
3939
run: |
4040
$version = (Get-Content package.json | ConvertFrom-Json).version
41-
$shortHash = git rev-parse --short HEAD
4241
$branch = "${{ github.ref_name }}"
42+
$buildNumber = "${{ github.run_number }}"
4343
4444
if ($branch -eq "develop") {
45-
$finalVersion = "v$version-dev-$shortHash"
45+
$finalVersion = "v$version-dev.$buildNumber"
4646
echo "version=$finalVersion" >> $env:GITHUB_OUTPUT
4747
echo "prerelease=true" >> $env:GITHUB_OUTPUT
4848
} else {
@@ -57,6 +57,7 @@ jobs:
5757
name: windows-artifacts
5858
path: |
5959
dist/DevNullifier-Setup.exe
60+
dist/DevNullifier-Setup.exe.blockmap
6061
dist/DevNullifier-win-unpacked.zip
6162
dist/latest.yml
6263
@@ -90,15 +91,18 @@ jobs:
9091
run: |
9192
APPIMAGE=$(find dist -name "*.AppImage" -type f | head -1)
9293
DEB=$(find dist -name "*.deb" -type f | head -1)
94+
BLOCKMAP=$(find dist -name "*.AppImage.blockmap" -type f | head -1)
9395
echo "appimage_path=$APPIMAGE" >> $GITHUB_OUTPUT
9496
echo "deb_path=$DEB" >> $GITHUB_OUTPUT
97+
echo "blockmap_path=$BLOCKMAP" >> $GITHUB_OUTPUT
9598
9699
- name: Upload Linux artifacts
97100
uses: actions/upload-artifact@v4
98101
with:
99102
name: linux-artifacts
100103
path: |
101104
${{ steps.find-installer.outputs.appimage_path }}
105+
${{ steps.find-installer.outputs.blockmap_path }}
102106
${{ steps.find-installer.outputs.deb_path }}
103107
dist/DevNullifier-linux-unpacked.zip
104108
dist/latest-linux.yml
@@ -223,155 +227,125 @@ jobs:
223227
224228
echo "LATEST_DEV_UPLOAD_URL=$UPLOAD_URL" >> $GITHUB_ENV
225229
226-
# Windows assets
227-
- name: Upload Windows Installer
228-
uses: actions/upload-release-asset@v1
230+
# Upload assets with error handling
231+
- name: Upload Release Assets
232+
id: upload_assets
233+
continue-on-error: true
229234
env:
230235
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
231-
with:
232-
upload_url: ${{ steps.create_release.outputs.upload_url }}
233-
asset_path: artifacts/windows/DevNullifier-Setup.exe
234-
asset_name: DevNullifier-Setup.exe
235-
asset_content_type: application/octet-stream
236+
RELEASE_ID: ${{ steps.create_release.outputs.id }}
237+
TAG_NAME: ${{ needs.build-windows.outputs.version }}
238+
run: |
239+
upload_asset() {
240+
local file="$1"
241+
local name="$2"
242+
local type="$3"
243+
244+
echo "Uploading $name..."
245+
curl --fail \
246+
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
247+
-H "Content-Type: ${type}" \
248+
--upload-file "${file}" \
249+
"${{ steps.create_release.outputs.upload_url }}?name=${name}"
250+
251+
if [ $? -ne 0 ]; then
252+
echo "::error::Failed to upload $name"
253+
exit 1
254+
fi
255+
}
236256
237-
- name: Upload latest.yml
238-
uses: actions/upload-release-asset@v1
239-
env:
240-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
241-
with:
242-
upload_url: ${{ steps.create_release.outputs.upload_url }}
243-
asset_path: artifacts/windows/latest.yml
244-
asset_name: latest.yml
245-
asset_content_type: text/yaml
257+
# Windows assets
258+
upload_asset "artifacts/windows/DevNullifier-Setup.exe" "DevNullifier-Setup.exe" "application/octet-stream"
259+
upload_asset "artifacts/windows/DevNullifier-Setup.exe.blockmap" "DevNullifier-Setup.exe.blockmap" "application/octet-stream"
260+
upload_asset "artifacts/windows/latest.yml" "latest.yml" "text/yaml"
261+
upload_asset "artifacts/windows/DevNullifier-win-unpacked.zip" "${{ github.ref_name == 'develop' && 'DevNullifier-win-unpacked-dev.zip' || 'DevNullifier-win-unpacked.zip' }}" "application/zip"
246262
247-
- name: Upload Windows ZIP Archive
248-
uses: actions/upload-release-asset@v1
249-
env:
250-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
251-
with:
252-
upload_url: ${{ steps.create_release.outputs.upload_url }}
253-
asset_path: artifacts/windows/DevNullifier-win-unpacked.zip
254-
asset_name: ${{ github.ref_name == 'develop' && 'DevNullifier-win-unpacked-dev.zip' || 'DevNullifier-win-unpacked.zip' }}
255-
asset_content_type: application/zip
256-
257-
# Linux assets
258-
- name: Find Linux files
259-
id: find-linux-files
260-
run: |
263+
# Linux assets
261264
APPIMAGE=$(find artifacts/linux -name "*.AppImage" -type f | head -1)
262265
DEB=$(find artifacts/linux -name "*.deb" -type f | head -1)
263-
echo "appimage_path=$APPIMAGE" >> $GITHUB_OUTPUT
264-
echo "deb_path=$DEB" >> $GITHUB_OUTPUT
265-
266-
- name: Upload Linux AppImage
267-
uses: actions/upload-release-asset@v1
268-
env:
269-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
270-
with:
271-
upload_url: ${{ steps.create_release.outputs.upload_url }}
272-
asset_path: ${{ steps.find-linux-files.outputs.appimage_path }}
273-
asset_name: ${{ github.ref_name == 'develop' && 'DevNullifier-linux-x64-dev.AppImage' || 'DevNullifier-linux-x64.AppImage' }}
274-
asset_content_type: application/octet-stream
275-
276-
- name: Upload Linux DEB
277-
uses: actions/upload-release-asset@v1
278-
env:
279-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
280-
with:
281-
upload_url: ${{ steps.create_release.outputs.upload_url }}
282-
asset_path: ${{ steps.find-linux-files.outputs.deb_path }}
283-
asset_name: ${{ github.ref_name == 'develop' && 'DevNullifier-linux-x64-dev.deb' || 'DevNullifier-linux-x64.deb' }}
284-
asset_content_type: application/octet-stream
285-
286-
- name: Upload Linux ZIP Archive
287-
uses: actions/upload-release-asset@v1
288-
env:
289-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
290-
with:
291-
upload_url: ${{ steps.create_release.outputs.upload_url }}
292-
asset_path: artifacts/linux/DevNullifier-linux-unpacked.zip
293-
asset_name: ${{ github.ref_name == 'develop' && 'DevNullifier-linux-unpacked-dev.zip' || 'DevNullifier-linux-unpacked.zip' }}
294-
asset_content_type: application/zip
266+
BLOCKMAP=$(find artifacts/linux -name "*.AppImage.blockmap" -type f | head -1)
267+
upload_asset "$APPIMAGE" "${{ github.ref_name == 'develop' && 'DevNullifier-linux-x64-dev.AppImage' || 'DevNullifier-linux-x64.AppImage' }}" "application/octet-stream"
268+
upload_asset "$BLOCKMAP" "${{ github.ref_name == 'develop' && 'DevNullifier-linux-x64-dev.AppImage.blockmap' || 'DevNullifier-linux-x64.AppImage.blockmap' }}" "application/octet-stream"
269+
upload_asset "$DEB" "${{ github.ref_name == 'develop' && 'DevNullifier-linux-x64-dev.deb' || 'DevNullifier-linux-x64.deb' }}" "application/octet-stream"
270+
upload_asset "artifacts/linux/DevNullifier-linux-unpacked.zip" "${{ github.ref_name == 'develop' && 'DevNullifier-linux-unpacked-dev.zip' || 'DevNullifier-linux-unpacked.zip' }}" "application/zip"
271+
upload_asset "artifacts/linux/latest-linux.yml" "latest-linux.yml" "text/yaml"
295272
296-
- name: Upload latest-linux.yml
297-
uses: actions/upload-release-asset@v1
298-
env:
299-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
300-
with:
301-
upload_url: ${{ steps.create_release.outputs.upload_url }}
302-
asset_path: artifacts/linux/latest-linux.yml
303-
asset_name: latest-linux.yml
304-
asset_content_type: text/yaml
305-
306-
# macOS assets
307-
- name: Find macOS files
308-
id: find-macos-files
309-
run: |
273+
# macOS assets
310274
DMG=$(find artifacts/macos -name "*.dmg" -type f | head -1)
311-
echo "dmg_path=$DMG" >> $GITHUB_OUTPUT
312-
313-
- name: Upload macOS DMG
314-
uses: actions/upload-release-asset@v1
315-
env:
316-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
317-
with:
318-
upload_url: ${{ steps.create_release.outputs.upload_url }}
319-
asset_path: ${{ steps.find-macos-files.outputs.dmg_path }}
320-
asset_name: ${{ github.ref_name == 'develop' && 'DevNullifier-mac-x64-dev.dmg' || 'DevNullifier-mac-x64.dmg' }}
321-
asset_content_type: application/octet-stream
275+
BLOCKMAP=$(find artifacts/macos -name "*.dmg.blockmap" -type f | head -1)
276+
upload_asset "$DMG" "${{ github.ref_name == 'develop' && 'DevNullifier-mac-x64-dev.dmg' || 'DevNullifier-mac-x64.dmg' }}" "application/octet-stream"
277+
upload_asset "$BLOCKMAP" "${{ github.ref_name == 'develop' && 'DevNullifier-mac-x64-dev.dmg.blockmap' || 'DevNullifier-mac-x64.dmg.blockmap' }}" "application/octet-stream"
278+
upload_asset "artifacts/macos/DevNullifier-mac-unpacked.zip" "${{ github.ref_name == 'develop' && 'DevNullifier-mac-unpacked-dev.zip' || 'DevNullifier-mac-unpacked.zip' }}" "application/zip"
279+
upload_asset "artifacts/macos/latest-mac.yml" "latest-mac.yml" "text/yaml"
322280
323-
- name: Upload macOS ZIP Archive
324-
uses: actions/upload-release-asset@v1
325-
env:
326-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
327-
with:
328-
upload_url: ${{ steps.create_release.outputs.upload_url }}
329-
asset_path: artifacts/macos/DevNullifier-mac-unpacked.zip
330-
asset_name: ${{ github.ref_name == 'develop' && 'DevNullifier-mac-unpacked-dev.zip' || 'DevNullifier-mac-unpacked.zip' }}
331-
asset_content_type: application/zip
281+
# Cleanup on failure
282+
- name: Cleanup on failure
283+
if: steps.upload_assets.outcome == 'failure'
284+
run: |
285+
echo "Upload failed, cleaning up..."
286+
287+
# Delete the release
288+
curl -X DELETE \
289+
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
290+
"https://api.github.com/repos/${{ github.repository }}/releases/${{ steps.create_release.outputs.id }}"
291+
292+
# Delete the tag
293+
git push --delete origin ${{ needs.build-windows.outputs.version }} || true
294+
295+
# If on develop, also clean up latest-dev
296+
if [ "${{ github.ref_name }}" = "develop" ]; then
297+
# Delete latest-dev release
298+
LATEST_DEV_ID=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
299+
"https://api.github.com/repos/${{ github.repository }}/releases/tags/latest-dev" | \
300+
jq -r '.id')
301+
if [ "$LATEST_DEV_ID" != "null" ]; then
302+
curl -X DELETE -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
303+
"https://api.github.com/repos/${{ github.repository }}/releases/$LATEST_DEV_ID"
304+
fi
305+
306+
# Delete latest-dev tag
307+
git push --delete origin latest-dev || true
308+
fi
332309
333-
- name: Upload latest-mac.yml
334-
uses: actions/upload-release-asset@v1
335-
env:
336-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
337-
with:
338-
upload_url: ${{ steps.create_release.outputs.upload_url }}
339-
asset_path: artifacts/macos/latest-mac.yml
340-
asset_name: latest-mac.yml
341-
asset_content_type: text/yaml
310+
exit 1
342311
343-
# Upload to latest-dev release if on develop branch
312+
# Upload to latest-dev release if on develop branch and main upload succeeded
344313
- name: Upload assets to latest-dev release
345-
if: github.ref_name == 'develop'
314+
if: github.ref_name == 'develop' && steps.upload_assets.outcome == 'success'
346315
run: |
347316
# Function to upload asset
348317
upload_asset() {
349318
local file="$1"
350319
local name="$2"
351320
local type="$3"
352321
353-
curl -X POST \
322+
curl --fail \
354323
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
355-
-H "Content-Type: $type" \
356-
--data-binary "@$file" \
357-
"${{ env.LATEST_DEV_UPLOAD_URL }}?name=$name"
324+
-H "Content-Type: ${type}" \
325+
--upload-file "${file}" \
326+
"${{ env.LATEST_DEV_UPLOAD_URL }}?name=${name}"
358327
}
359328
360329
# Upload Windows assets
361330
upload_asset "artifacts/windows/DevNullifier-Setup.exe" "DevNullifier-Setup.exe" "application/octet-stream"
331+
upload_asset "artifacts/windows/DevNullifier-Setup.exe.blockmap" "DevNullifier-Setup.exe.blockmap" "application/octet-stream"
362332
upload_asset "artifacts/windows/latest.yml" "latest.yml" "text/yaml"
363333
upload_asset "artifacts/windows/DevNullifier-win-unpacked.zip" "DevNullifier-win-unpacked.zip" "application/zip"
364334
365335
# Upload Linux assets
366336
APPIMAGE=$(find artifacts/linux -name "*.AppImage" -type f | head -1)
337+
BLOCKMAP=$(find artifacts/linux -name "*.AppImage.blockmap" -type f | head -1)
367338
DEB=$(find artifacts/linux -name "*.deb" -type f | head -1)
368339
upload_asset "$APPIMAGE" "DevNullifier-linux-x64.AppImage" "application/octet-stream"
340+
upload_asset "$BLOCKMAP" "DevNullifier-linux-x64.AppImage.blockmap" "application/octet-stream"
369341
upload_asset "$DEB" "DevNullifier-linux-x64.deb" "application/octet-stream"
370342
upload_asset "artifacts/linux/DevNullifier-linux-unpacked.zip" "DevNullifier-linux-unpacked.zip" "application/zip"
371343
upload_asset "artifacts/linux/latest-linux.yml" "latest-linux.yml" "text/yaml"
372344
373345
# Upload macOS assets
374346
DMG=$(find artifacts/macos -name "*.dmg" -type f | head -1)
347+
BLOCKMAP=$(find artifacts/macos -name "*.dmg.blockmap" -type f | head -1)
375348
upload_asset "$DMG" "DevNullifier-mac-x64.dmg" "application/octet-stream"
349+
upload_asset "$BLOCKMAP" "DevNullifier-mac-x64.dmg.blockmap" "application/octet-stream"
376350
upload_asset "artifacts/macos/DevNullifier-mac-unpacked.zip" "DevNullifier-mac-unpacked.zip" "application/zip"
377351
upload_asset "artifacts/macos/latest-mac.yml" "latest-mac.yml" "text/yaml"

src/main/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function createWindow() {
4141
// Initialize update service
4242
updateService = new UpdateService(mainWindow);
4343
if (!isDev) {
44-
//updateService.checkForUpdates(); TODO: Uncomment this when ready to release
44+
updateService.checkForUpdates();
4545
}
4646
}
4747

src/main/preload.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ const api: ElectronAPI = {
119119
quitAndInstall: () => ipcRenderer.invoke("quit-and-install"),
120120

121121
// New handler
122-
setUpdateChannel: (channel: 'latest' | 'latest-develop') => ipcRenderer.invoke('set-update-channel', channel),
122+
setUpdateChannel: (channel: 'latest' | 'latest-dev') => ipcRenderer.invoke('set-update-channel', channel),
123123
};
124124

125125
contextBridge.exposeInMainWorld("electronAPI", api);

src/main/updateService.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,21 @@ export class UpdateService {
1414
private setupIpcHandlers() {
1515
ipcMain.handle(
1616
"set-update-channel",
17-
(_, channel: "latest" | "latest-develop") => {
17+
(_, channel: "latest" | "latest-dev") => {
1818
this.setUpdateChannel(channel);
1919
}
2020
);
2121
}
2222

23-
private setUpdateChannel(channel: "latest" | "latest-develop") {
24-
autoUpdater.allowPrerelease = channel === "latest-develop";
23+
private setUpdateChannel(channel: "latest" | "latest-dev") {
24+
autoUpdater.allowPrerelease = channel === "latest-dev";
2525

2626
let baseUrl =
2727
channel === "latest"
2828
? "https://github.com/Hermesiss/DevNullifier/releases/latest/download/"
2929
: "https://github.com/Hermesiss/DevNullifier/releases/download/latest-dev/";
3030

3131
autoUpdater.setFeedURL(baseUrl);
32-
33-
// Set platform-specific update config path
34-
// if (process.platform === "win32") {
35-
// autoUpdater.updateConfigPath = baseUrl + "latest.yml";
36-
// } else if (process.platform === "darwin") {
37-
// autoUpdater.updateConfigPath = baseUrl + "latest-mac.yml";
38-
// } else if (process.platform === "linux") {
39-
// autoUpdater.updateConfigPath = baseUrl + "latest-linux.yml";
40-
// }
4132
}
4233

4334
private initializeAutoUpdater() {

src/renderer/components/UpdateButton.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,14 @@ function handleUpdateStatus(status: { message: string; data?: any }) {
131131
132132
async function handleBetaChannelChange() {
133133
localStorage.setItem('useBetaChannel', useBetaChannel.value.toString());
134-
await window.electronAPI.setUpdateChannel(useBetaChannel.value ? 'latest-develop' : 'latest');
134+
await window.electronAPI.setUpdateChannel(useBetaChannel.value ? 'latest-dev' : 'latest');
135135
checkForUpdates();
136136
}
137137
138-
onMounted(() => {
138+
onMounted(async () => {
139139
window.electronAPI.onUpdateStatus(handleUpdateStatus);
140140
// Set initial update channel
141-
window.electronAPI.setUpdateChannel(useBetaChannel.value ? 'latest-develop' : 'latest');
141+
await window.electronAPI.setUpdateChannel(useBetaChannel.value ? 'latest-dev' : 'latest');
142142
});
143143
144144
onUnmounted(() => {

src/renderer/types/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export interface ElectronAPI {
5757
saveDeveloperProjects: (projects: ProjectInfo[]) => Promise<void>;
5858
loadSavedDeveloperProjects: () => Promise<ProjectInfo[]>;
5959
getSavedDeveloperProjectsCount: () => Promise<number>;
60-
setUpdateChannel: (channel: 'latest' | 'latest-develop') => Promise<void>;
60+
setUpdateChannel: (channel: 'latest' | 'latest-dev') => Promise<void>;
6161
}
6262

6363
// Add global type augmentation for Window interface

0 commit comments

Comments
 (0)