diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 663814dc..52a672a1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -89,12 +89,15 @@ jobs: - name: Stage release artifacts run: | mkdir -p release-assets - cp out/make/AppImage/**/*.AppImage release-assets/ + VERSION=$(node -e "console.log(require('./package.json').version)") + APPIMAGE_PATH=$(find out/make/AppImage -name '*.AppImage' | head -n 1) + [ -n "$APPIMAGE_PATH" ] || exit 1 + cp "$APPIMAGE_PATH" "release-assets/5chan-${VERSION}-${{ matrix.arch }}.AppImage" - name: Create static HTML release archive if: matrix.arch == 'x64' run: | VERSION=$(node -e "console.log(require('./package.json').version)") - HTML_ARCHIVE_DIR="5chan-html-$VERSION" + HTML_ARCHIVE_DIR="5chan-$VERSION-html" rm -rf "$HTML_ARCHIVE_DIR" cp -R build "$HTML_ARCHIVE_DIR" zip -r "release-assets/${HTML_ARCHIVE_DIR}.zip" "$HTML_ARCHIVE_DIR" @@ -154,18 +157,16 @@ jobs: else yarn electron:build:mac:x64 fi - - name: Rename DMG with version and architecture suffix - run: | - VERSION=$(node -e "console.log(require('./package.json').version)") - for f in out/make/*.dmg; do - [ -f "$f" ] || continue - mv "$f" "out/make/5chan-${VERSION}-${{ matrix.arch }}.dmg" - done - name: Stage release artifacts run: | mkdir -p release-assets - cp out/make/*.dmg release-assets/ 2>/dev/null || true - find out/make/zip -name '*.zip' -exec cp {} release-assets/ \; 2>/dev/null || true + VERSION=$(node -e "console.log(require('./package.json').version)") + DMG_PATH=$(find out/make -maxdepth 1 -name '*.dmg' | head -n 1) + ZIP_PATH=$(find out/make/zip -name '*.zip' | head -n 1) + [ -n "$DMG_PATH" ] || exit 1 + [ -n "$ZIP_PATH" ] || exit 1 + cp "$DMG_PATH" "release-assets/5chan-${VERSION}-${{ matrix.arch }}.dmg" + cp "$ZIP_PATH" "release-assets/5chan-${VERSION}-${{ matrix.arch }}.zip" - name: List release assets run: ls -la release-assets - uses: actions/upload-artifact@v4 @@ -204,7 +205,10 @@ jobs: shell: bash run: | mkdir -p release-assets - cp out/make/squirrel.windows/x64/*.exe release-assets/ + VERSION=$(node -e "console.log(require('./package.json').version)") + SETUP_EXE_PATH=$(find out/make -iname '*setup*.exe' | head -n 1) + [ -n "$SETUP_EXE_PATH" ] || exit 1 + cp "$SETUP_EXE_PATH" "release-assets/5chan-${VERSION}-x64.Setup.exe" - name: List release assets shell: bash run: ls -la release-assets diff --git a/scripts/deploy.sh b/scripts/deploy.sh index cb557503..c82100c8 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -17,7 +17,7 @@ if [ -z "${DEPLOY_PASSWORD+xxx}" ]; then echo "DEPLOY_PASSWORD not set" && exit; # save version FIVECHAN_VERSION=$(node -e "console.log(require('../package.json').version)") -FIVECHAN_HTML_NAME="5chan-html-$FIVECHAN_VERSION" +FIVECHAN_HTML_NAME="5chan-$FIVECHAN_VERSION-html" SCRIPT=" # download html diff --git a/scripts/release-body.js b/scripts/release-body.js index 68d34f2c..e7002ee1 100644 --- a/scripts/release-body.js +++ b/scripts/release-body.js @@ -54,10 +54,11 @@ const linkTo = (file) => `https://github.com/bitsocialnet/5chan/releases/downloa const has = (s, sub) => s.toLowerCase().includes(sub); const isArm = (s) => has(s, 'arm64') || has(s, 'aarch64'); const isX64 = (s) => has(s, 'x64') || has(s, 'x86_64') || !isArm(s); +const isHtmlArchive = (file) => file.toLowerCase().endsWith('.zip') && (has(file, '5chan-html') || has(file, '-html')); // buckets const androidApk = files.find((f) => f.endsWith('.apk')); -const htmlZip = files.find((f) => f.includes('5chan-html') && f.endsWith('.zip')); +const htmlZip = files.find(isHtmlArchive); const linux = files.filter((f) => f.endsWith('.AppImage')); const mac = files.filter((f) => f.endsWith('.dmg')); @@ -98,7 +99,7 @@ const linuxSection = section('Linux', [ const androidSection = section('Android', [androidApk && `- APK: [Download](${linkTo(androidApk)})`]); -const htmlSection = section('Static HTML build', [htmlZip && `- 5chan-html (zip): [Download](${linkTo(htmlZip)})`]); +const htmlSection = section('Static HTML build', [htmlZip && `- Static HTML archive (zip): [Download](${linkTo(htmlZip)})`]); const downloads = [macSection, winSection, linuxSection, androidSection, htmlSection].filter(Boolean).join('\n\n'); diff --git a/src/lib/__tests__/app-update.test.ts b/src/lib/__tests__/app-update.test.ts index 6235d09f..10b4a215 100644 --- a/src/lib/__tests__/app-update.test.ts +++ b/src/lib/__tests__/app-update.test.ts @@ -332,8 +332,8 @@ describe('app-update', () => { await applyAvailableAppUpdate({ runtime: 'electron', targetVersion: '9.9.9', - assetName: '5chan-9.9.9.Setup.exe', - downloadUrl: 'https://github.com/bitsocialnet/5chan/releases/download/v9.9.9/5chan-9.9.9.Setup.exe', + assetName: '5chan-9.9.9-x64.Setup.exe', + downloadUrl: 'https://github.com/bitsocialnet/5chan/releases/download/v9.9.9/5chan-9.9.9-x64.Setup.exe', releaseUrl: 'https://github.com/bitsocialnet/5chan/releases/tag/v9.9.9', }); await applyAvailableAppUpdate({ @@ -345,8 +345,8 @@ describe('app-update', () => { }); expect(testState.electronDownloadAndInstallUpdateMock).toHaveBeenCalledWith({ - url: 'https://github.com/bitsocialnet/5chan/releases/download/v9.9.9/5chan-9.9.9.Setup.exe', - fileName: '5chan-9.9.9.Setup.exe', + url: 'https://github.com/bitsocialnet/5chan/releases/download/v9.9.9/5chan-9.9.9-x64.Setup.exe', + fileName: '5chan-9.9.9-x64.Setup.exe', }); expect(testState.androidDownloadAndInstallUpdateMock).toHaveBeenCalledWith({ url: 'https://github.com/bitsocialnet/5chan/releases/download/v9.9.9/5chan-9.9.9.apk',