mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-04-26 01:10:16 +08:00
112 lines
3.0 KiB
YAML
112 lines
3.0 KiB
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags:
|
|
- "*"
|
|
paths-ignore:
|
|
- "**.md"
|
|
- "**.spec.js"
|
|
- ".idea"
|
|
- ".vscode"
|
|
- ".dockerignore"
|
|
- "Dockerfile"
|
|
- ".gitignore"
|
|
- ".github/**"
|
|
- "!.github/workflows/build.yml"
|
|
pull_request:
|
|
branches: [main]
|
|
paths-ignore:
|
|
- "**.md"
|
|
- "**.spec.js"
|
|
- ".idea"
|
|
- ".vscode"
|
|
- ".dockerignore"
|
|
- "Dockerfile"
|
|
- ".gitignore"
|
|
- ".github/**"
|
|
- "!.github/workflows/build.yml"
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ${{ matrix.os }}
|
|
container: ${{ matrix.docker_image }}
|
|
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest]
|
|
package: [deb, rpm]
|
|
architecture: [x64, arm64]
|
|
include:
|
|
- package: deb
|
|
docker_image: "debian:12"
|
|
- package: rpm
|
|
docker_image: "almalinux:8"
|
|
|
|
|
|
steps:
|
|
- name: Install Build Dependencies
|
|
if: matrix.package == 'deb'
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y curl git wget devscripts fakeroot equivs lintian python3
|
|
apt-get install -y build-essential
|
|
|
|
- name: Install Build Dependencies
|
|
if: matrix.package == 'rpm'
|
|
run: |
|
|
dnf install -y curl git wget rpm-build rpmdevtools rpmlint python3
|
|
dnf group install -y "Development Tools"
|
|
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: 20.19.2
|
|
|
|
- name: Install Dependencies
|
|
run: |
|
|
npm install
|
|
|
|
- name: Download host-spawn
|
|
shell: bash
|
|
run: |
|
|
if [ "${{ matrix.architecture }}" == "x64" ]; then
|
|
curl -fsSL -o ./extras/host-spawn https://github.com/1player/host-spawn/releases/latest/download/host-spawn-x86_64
|
|
elif [ "${{ matrix.architecture }}" == "arm64" ]; then
|
|
curl -fsSL -o ./extras/host-spawn https://github.com/1player/host-spawn/releases/latest/download/host-spawn-aarch64
|
|
fi
|
|
|
|
- name: Build Release Files
|
|
shell: bash
|
|
run: |
|
|
if [ "${{ matrix.package }}" == "deb" ]; then
|
|
npm run build:deb -- --${{ matrix.architecture }}
|
|
elif [ "${{ matrix.package }}" == "rpm" ]; then
|
|
npm run build:rpm -- --${{ matrix.architecture }}
|
|
fi
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v6
|
|
with:
|
|
name: release_for_${{ matrix.package }}_${{ matrix.architecture }}
|
|
path: release/**/*.${{ matrix.package }}
|
|
retention-days: 5
|
|
|
|
- name: Upload to GitHub Release
|
|
if: github.event_name == 'release' || startsWith(github.ref, 'refs/tags/')
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ github.ref_name }}
|
|
files: |
|
|
release/**/*.deb
|
|
release/**/*.rpm
|
|
generate_release_notes: true |