Files
myspeed/.github/workflows/build-binaries.yml
T
2026-01-22 15:00:01 +01:00

237 lines
6.4 KiB
YAML

name: Build Binaries
on:
workflow_call:
inputs:
version:
required: true
type: string
release_id:
required: true
type: string
jobs:
build-windows:
name: "Windows (x64)"
runs-on: windows-latest
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install client dependencies
working-directory: client
run: npm install --force
- name: Build client
working-directory: client
run: npm run build
- name: Move build folder
run: Move-Item -Path client/build -Destination .
- name: Compile binary
run: deno compile --allow-all --no-check --include build --include server/integrations --include server/templates --target x86_64-pc-windows-msvc --output MySpeed.exe server/index.js
env:
RUST_MIN_STACK: 16777216
- name: Upload to Release
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: ${{ inputs.release_id }},
name: 'MySpeed-windows-x64.exe',
data: fs.readFileSync('MySpeed.exe')
});
- name: Upload artifact for MSI
uses: actions/upload-artifact@v4
with:
name: MySpeed-windows-x64.exe
path: MySpeed.exe
- name: Upload build folder for MSI
uses: actions/upload-artifact@v4
with:
name: build-folder
path: build
build-linux:
name: "Linux (${{ matrix.arch }})"
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- arch: x64
target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
artifact_name: MySpeed-linux-x64
- arch: arm64
target: aarch64-unknown-linux-gnu
runner: ubuntu-24.04-arm
artifact_name: MySpeed-linux-arm64
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install client dependencies
working-directory: client
run: npm install --force
- name: Build client
working-directory: client
run: npm run build
- name: Move build folder
run: mv client/build .
- name: Compile binary
run: deno compile --allow-all --no-check --include build --include server/integrations --include server/templates --target ${{ matrix.target }} --output MySpeed server/index.js
env:
RUST_MIN_STACK: 8388608
- name: Rename binary
run: mv MySpeed ${{ matrix.artifact_name }}
- name: Upload to Release
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: ${{ inputs.release_id }},
name: '${{ matrix.artifact_name }}',
data: fs.readFileSync('${{ matrix.artifact_name }}')
});
build-macos:
name: "macOS (${{ matrix.arch }})"
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
include:
- arch: x64
target: x86_64-apple-darwin
artifact_name: MySpeed-macos-x64
- arch: arm64
target: aarch64-apple-darwin
artifact_name: MySpeed-macos-arm64
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install client dependencies
working-directory: client
run: npm install --force
- name: Build client
working-directory: client
run: npm run build
- name: Move build folder
run: mv client/build .
- name: Compile binary
run: deno compile --allow-all --no-check --include build --include server/integrations --include server/templates --target ${{ matrix.target }} --output MySpeed server/index.js
env:
RUST_MIN_STACK: 8388608
- name: Rename binary
run: mv MySpeed ${{ matrix.artifact_name }}
- name: Upload to Release
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: ${{ inputs.release_id }},
name: '${{ matrix.artifact_name }}',
data: fs.readFileSync('${{ matrix.artifact_name }}')
});
build-zip:
name: "Source ZIP"
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install client dependencies
working-directory: client
run: npm install --force
- name: Build client
working-directory: client
run: npm run build
- name: Move build folder
run: mv client/build .
- name: Create zip archive
run: zip -r MySpeed.zip build server deno.json
- name: Upload to Release
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: ${{ inputs.release_id }},
name: 'MySpeed.zip',
data: fs.readFileSync('MySpeed.zip')
});