fix(release): normalize asset names

This commit is contained in:
Tommaso Casaburi
2026-03-21 12:41:32 +08:00
parent 7af59ae556
commit 85e81aae2e
4 changed files with 24 additions and 19 deletions
+16 -12
View File
@@ -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
+1 -1
View File
@@ -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
+3 -2
View File
@@ -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');
+4 -4
View File
@@ -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',