Skip to content

Build (Manual)

Build (Manual) #19

Workflow file for this run

name: Build (Manual)
on:
workflow_dispatch:
jobs:
# ==========================================
# 统一构建步骤 (webpack:prod)
# ==========================================
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
persist-credentials: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: 'npm'
- name: Install dependencies
run: |
rm -f package-lock.json
npm install --loglevel=info
- name: Fetch
run: npm run fetch
- name: Compile (webpack:prod)
run: npm run webpack:prod
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
dist-astra-extensions/
dist-extensions/
dist-library-files/
dist-renderer-webpack/
retention-days: 1
# ==========================================
# Linux 标准格式打包 (5格式 × 3架构)
# ==========================================
package-linux:
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
format: [debian, tarball, appimage, pacman, rpm]
arch: [x64, armv7l, arm64]
include:
- format: pacman
extra-deps: 'ruby ruby-dev rubygems libarchive-tools'
- format: rpm
extra-deps: 'rpm ruby ruby-dev rubygems'
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
persist-credentials: false
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y strip-nondeterminism fakeroot ${{ matrix.extra-deps }}
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: 'npm'
- name: Install fpm
if: matrix.format == 'pacman' || matrix.format == 'rpm'
run: sudo gem install --no-document fpm
- name: Install dependencies (skip postinstall)
run: |
rm -f package-lock.json
npm install --loglevel=info --ignore-scripts
- name: Package
run: |
node release-automation/build.mjs --${{ matrix.format }} --${{ matrix.arch }} --production
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: linux-${{ matrix.format }}-${{ matrix.arch }}
path: dist/*.*
retention-days: 1
flatpak:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 24
- name: Install dependencies
run: npm ci
- name: Build Linux app
run: npm run build:linux
- name: Install Flatpak
run: |
sudo apt update
sudo apt install -y flatpak flatpak-builder
flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak --user install -y flathub org.freedesktop.Platform/x86_64/23.08
flatpak --user install -y flathub org.freedesktop.Sdk/x86_64/23.08
- name: Add Flathub runtime
run: |
flatpak --user remote-add --if-not-exists flathub \
https://flathub.org/repo/flathub.flatpakrepo
- name: Build Flatpak
run: |
flatpak-builder --user build-dir flatpak/org.astraeditor.AstraEditor.yml \
--force-clean
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: linux-build
path: dist-linux
- name: Install runtime
run: |
flatpak --user install -y flathub \
org.freedesktop.Platform//23.08 \
org.freedesktop.Sdk//23.08
- name: Create Bundle
run: |
flatpak --user build-bundle build-dir \
AstraEditor.flatpak \
org.astraeditor.AstraEditor
- uses: actions/upload-artifact@v4
with:
name: AstraEditor-flatpak
path: AstraEditor.flatpak
# ==========================================
# Linux Snap 打包 (仅 x64)
# ==========================================
package-linux-snap:
needs: build
runs-on: ubuntu-latest
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
persist-credentials: false
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y strip-nondeterminism fakeroot snapd
- name: Setup Snapcraft
run: |
sudo snap install snapcraft --classic
sudo snap install lxd
sudo lxd init --auto
sudo usermod -aG lxd $USER
newgrp lxd
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: 'npm'
- name: Install dependencies (skip postinstall)
run: |
rm -f package-lock.json
npm install --loglevel=info --ignore-scripts
- name: Package
run: |
node release-automation/build.mjs --snap --x64 --production
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: linux-snap-x64
path: dist/*.*
retention-days: 1
# ==========================================
# Mac 打包
# ==========================================
package-mac:
needs: build
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
include:
- target: modern
args: '--mac --universal'
- target: legacy-10.13-10.14
args: '--mac-legacy-10.13-10.14 --x64'
- target: legacy-10.15
args: '--mac-legacy-10.15 --x64'
- target: legacy-11
args: '--mac-legacy-11 --universal'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
persist-credentials: false
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: 'npm'
- name: Install dependencies (skip postinstall)
run: |
rm -f package-lock.json
npm install --loglevel=info --ignore-scripts
- name: Package
run: |
node release-automation/build.mjs ${{ matrix.args }} --production
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: mac-${{ matrix.target }}
path: dist/*.dmg
retention-days: 1
# ==========================================
# Windows 打包
# ==========================================
package-windows:
needs: build
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- target: modern-nsis-x64
args: '--windows --x64'
files: '*.exe'
- target: modern-nsis-ia32
args: '--windows --ia32'
files: '*.exe'
- target: modern-nsis-arm64
args: '--windows --arm64'
files: '*.exe'
- target: modern-appx-x64
args: '--microsoft-store --x64'
files: '*.appx'
- target: modern-appx-ia32
args: '--microsoft-store --ia32'
files: '*.appx'
- target: modern-appx-arm64
args: '--microsoft-store --arm64'
files: '*.appx'
- target: portable
args: '--windows-portable --x64'
files: '*.exe'
- target: legacy-x64
args: '--windows-legacy --x64'
files: '*.exe'
- target: legacy-ia32
args: '--windows-legacy --ia32'
files: '*.exe'
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
persist-credentials: false
path: repo
- name: Move to D drive
shell: pwsh
run: |
Copy-Item -Path repo -Destination D:\repo -Recurse
Remove-Item -Path repo -Recurse -Force
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: D:\repo\
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 24
- name: Configure npm cache
shell: pwsh
run: |
npm config set cache D:\npm-cache
npm config set prefix D:\npm-prefix
- name: Install dependencies (skip postinstall)
working-directory: D:\repo
run: |
Remove-Item -Path package-lock.json -Force -ErrorAction SilentlyContinue
npm install --loglevel=info --ignore-scripts
- name: Package
working-directory: D:\repo
run: |
node release-automation/build.mjs ${{ matrix.args }} --production
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: windows-${{ matrix.target }}
path: D:\repo\dist\${{ matrix.files }}
retention-days: 1