Add Bonfida import fix script and improve release workflow

This commit is contained in:
plebeius
2026-01-30 11:50:20 +08:00
parent 7020dfb17b
commit 431e171049
5 changed files with 387 additions and 74 deletions
+81 -38
View File
@@ -11,6 +11,10 @@ on:
jobs:
linux:
strategy:
fail-fast: false
matrix:
arch: [x64, arm64]
runs-on: ubuntu-22.04
permissions:
contents: write
@@ -20,24 +24,23 @@ jobs:
with:
# needed for git commit history changelog
fetch-depth: 0
- name: Setup Node.js v20
uses: actions/setup-node@v2
with:
node-version: 20
- name: Install dependencies (with Node v20)
run: yarn install --frozen-lockfile --ignore-engines
# make sure the ipfs executable is executable
- name: Download IPFS and set permissions (with Node v20)
run: node electron/download-ipfs && sudo chmod +x bin/linux/ipfs
- name: Setup Node.js v22 for Electron build
- name: Setup Node.js v22
uses: actions/setup-node@v2
with:
node-version: 22
- name: Install dependencies (with Node v22)
run: yarn install --frozen-lockfile --ignore-engines
# make sure the ipfs executable is executable
- name: Download IPFS and set permissions (with Node v22)
run: node electron/download-ipfs && sudo chmod +x bin/linux/ipfs
- name: Build React app (with Node v22)
run: CI='' yarn build
- name: Build Electron app for Linux (with Node v22)
run: yarn electron:build:linux
run: CI='' NODE_ENV=production yarn build
- name: Build Electron app for Linux (arm64)
if: ${{ matrix.arch == 'arm64' }}
run: yarn electron:build:linux:arm64
- name: Build Electron app for Linux (x64)
if: ${{ matrix.arch == 'x64' }}
run: yarn electron:build:linux:x64
- name: List dist directory
run: ls dist
@@ -46,14 +49,22 @@ jobs:
run: node scripts/release-body > release-body.txt
- uses: ncipollo/release-action@v1
with:
artifacts: 'dist/5chan*.AppImage,dist/5chan-html*.zip'
artifacts: 'dist/5chan*.AppImage,dist/5chan*-arm64.AppImage,dist/5chan-html*.zip'
token: ${{ secrets.GITHUB_TOKEN }}
replacesArtifacts: true
bodyFile: "release-body.txt"
omitBody: true
allowUpdates: true
mac:
runs-on: macos-15
strategy:
fail-fast: false
matrix:
include:
- runner: macos-15-intel # Intel x64
arch: x64
- runner: macos-latest # Apple Silicon arm64
arch: arm64
runs-on: ${{ matrix.runner }}
permissions:
contents: write
steps:
@@ -62,10 +73,14 @@ jobs:
with:
# needed for git commit history changelog
fetch-depth: 0
- name: Setup Node.js v20
- name: Setup Node.js v22
uses: actions/setup-node@v2
with:
node-version: 20
node-version: 22
- name: Setup Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
# install missing dep for sqlite (use setup-python to avoid PEP 668 externally-managed-environment error)
- uses: actions/setup-python@v5
@@ -73,20 +88,22 @@ jobs:
python-version: '3.12'
- run: pip install setuptools
- name: Install dependencies (with Node v20)
- name: Install dependencies (with Node v22)
run: yarn install --frozen-lockfile --ignore-engines
# make sure the ipfs executable is executable
- name: Download IPFS and set permissions (with Node v20)
- name: Download IPFS and set permissions (with Node v22)
run: node electron/download-ipfs && sudo chmod +x bin/mac/ipfs
- name: Setup Node.js v22 for Electron build
uses: actions/setup-node@v2
with:
node-version: 22
- name: Build React app (with Node v22)
run: CI='' yarn build
run: CI='' NODE_ENV=production yarn build
- name: Build Electron app for Mac (with Node v22)
run: yarn electron:build:mac
env:
CSC_IDENTITY_AUTO_DISCOVERY: 'false'
run: |
if [ "${{ matrix.arch }}" = "arm64" ]; then
yarn electron:build:mac:arm64
else
yarn electron:build:mac:x64
fi
- name: List dist directory
run: ls dist
@@ -95,10 +112,10 @@ jobs:
run: node scripts/release-body > release-body.txt
- uses: ncipollo/release-action@v1
with:
artifacts: 'dist/5chan*.dmg'
artifacts: 'dist/5chan*.dmg,dist/5chan*-arm64.dmg'
token: ${{ secrets.GITHUB_TOKEN }}
replacesArtifacts: true
bodyFile: "release-body.txt"
omitBody: true
allowUpdates: true
windows:
@@ -118,8 +135,8 @@ jobs:
- name: Install dependencies (with Node v22) # --network-timeout and --network-concurrency are yarn v1 flags.
run: yarn install --frozen-lockfile --network-timeout 100000 --network-concurrency 1
- name: Build React app (with Node v22)
run: yarn build
- name: Build Electron app for Windows (with Node v22)
run: npx cross-env NODE_ENV=production yarn build
- name: Build Electron app for Windows (x64)
run: yarn electron:build:windows
- name: List dist directory
run: dir dist
@@ -132,7 +149,7 @@ jobs:
artifacts: 'dist/5chan*.exe'
token: ${{ secrets.GITHUB_TOKEN }}
replacesArtifacts: true
bodyFile: "release-body.txt"
omitBody: true
allowUpdates: true
android:
@@ -153,14 +170,14 @@ jobs:
gradle-version: 8.9
- uses: actions/setup-node@v2
with:
node-version: 20
node-version: 22
- run: sudo apt install -y apksigner zipalign
# install all dependencies (including devDependencies needed for React build)
- name: Install dependencies (with Node v20)
- name: Install dependencies (with Node v22)
run: yarn install --frozen-lockfile --ignore-engines
# build react app
- run: CI='' yarn build
- run: CI='' NODE_ENV=production yarn build
# set android versionCode and versionName
- run: sed -i "s/versionCode 1/versionCode $(git tag | wc -l)/" ./android/app/build.gradle
- run: sed -i "s/versionName \"1.0\"/versionName \"$(node -e "console.log(require('./package.json').version)")\"/" ./android/app/build.gradle
@@ -168,7 +185,7 @@ jobs:
# build apk
- run: npx cap sync android
- run: cd android && gradle bundle
- run: cd android && ./gradlew assembleRelease
- run: cd android && ./gradlew assembleRelease --stacktrace
# optimize apk
- run: cd android/app/build/outputs/apk/release && zipalign 4 app-release-unsigned.apk app-release-unsigned-zip.apk
# sign apk
@@ -185,5 +202,31 @@ jobs:
artifacts: 'dist/5chan*.apk'
token: ${{ secrets.GITHUB_TOKEN }}
replacesArtifacts: true
bodyFile: "release-body.txt"
omitBody: true
allowUpdates: true
finalize-release:
runs-on: ubuntu-22.04
needs: [linux, mac, windows, android]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node.js v22
uses: actions/setup-node@v2
with:
node-version: 22
- name: Install dependencies
run: yarn install --frozen-lockfile --ignore-engines
- name: Generate final release body from GitHub assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_REF_NAME: ${{ github.ref_name }}
run: node scripts/release-body > release-body.txt
- name: Update release body only
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
bodyFile: "release-body.txt"