Skip to content

fix: electron builder config filename #65

fix: electron builder config filename

fix: electron builder config filename #65

Workflow file for this run

name: Release
on:
push:
tags:
- '*'
jobs:
build-artifacts:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-15-intel
platform: darwin
arch: x64
artifact_name: darwin-x64
- os: macos-26
platform: darwin
arch: arm64
artifact_name: darwin-arm64
- os: windows-latest
platform: win32
arch: x64
artifact_name: win32-x64
- os: windows-11-arm
platform: win32
arch: arm64
artifact_name: win32-arm64
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Cache Node Modules
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ matrix.os }}-${{ matrix.platform }}-${{ matrix.arch }}-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
shell: bash
run: |
if [ -d "node_modules" ]; then
echo "node_modules exists"
else
npm cache clean --force
npm ci --force
fi
- name: Build application
run: npm run build
env:
GA_TC: ${{ secrets.GA_TC }}
GA_MP: ${{ secrets.GA_MP }}
- name: Build for ${{ matrix.platform }}-${{ matrix.arch }}
run: npm run pack
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: List build artifacts
shell: bash
run: |
echo "Build artifacts:"
if echo "${{ matrix.os }}" | grep -qi "windows"; then
powershell -Command "if (-Not (Test-Path 'release')) { echo 'No release directory found' }"
powershell -Command "if (Test-Path 'release\\*.exe') { Get-ChildItem 'release\\*.exe' -Recurse } else { echo 'No .exe files found' }"
powershell -Command "if (Test-Path 'release\\*.zip') { Get-ChildItem 'release\\*.zip' -Recurse } else { echo 'No .zip files found' }"
else
ls -la release/ || echo "No release directory found"
find release/ -type f \( -name "*.dmg" -o -name "*.zip" -o -name "*.AppImage" \) || echo "No build artifacts found"
fi
- name: Upload artifacts to GitHub
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}-${{ github.ref_name }}
path: |
release/*.dmg
release/*.exe
release/*.zip
release/*.AppImage
retention-days: 30
- name: Upload artifacts to COS
run: node scripts/upload-artifacts-to-cos.js ${{ github.ref_name }}
env:
COS_SECRET_ID: ${{ secrets.COS_SECRET_ID }}
COS_SECRET_KEY: ${{ secrets.COS_SECRET_KEY }}
COS_DOMAIN: ${{ secrets.COS_DOMAIN }}
COS_BUCKET: ${{ secrets.COS_BUCKET }}
COS_REGION: ${{ secrets.COS_REGION }}
create-release:
needs: build-artifacts
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get tag information
id: tag_info
run: |
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
TAG_MESSAGE=$(git tag -l --format='%(contents)' ${{ github.ref_name }})
if [ -z "$TAG_MESSAGE" ]; then
TAG_MESSAGE="No description provided for this release."
fi
echo "tag_message<<EOF" >> $GITHUB_OUTPUT
echo "$TAG_MESSAGE" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "TAG_MESSAGE: $TAG_MESSAGE"
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
- name: List artifacts
run: tree -a artifacts/
- name: Install dependencies
run: npm run ci:create-release
- name: Upload version index to COS
run: node scripts/upload-version-index-to-cos.js ${{ github.ref_name }}
env:
COS_SECRET_ID: ${{ secrets.COS_SECRET_ID }}
COS_SECRET_KEY: ${{ secrets.COS_SECRET_KEY }}
COS_DOMAIN: ${{ secrets.COS_DOMAIN }}
COS_BUCKET: ${{ secrets.COS_BUCKET }}
COS_REGION: ${{ secrets.COS_REGION }}
TZ: Asia/Shanghai
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
draft: false
prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') }}
files: |
artifacts/darwin-x64-${{ github.ref_name }}/*
artifacts/darwin-arm64-${{ github.ref_name }}/*
artifacts/win32-x64-${{ github.ref_name }}/*
artifacts/win32-arm64-${{ github.ref_name }}/*
body: |
${{ steps.tag_info.outputs.tag_message }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}