Files
muSRFlow/.gitea/workflows/build-and-package.yml
T
salman 882f594d5a Pass validated runtime artifacts between Gitea build workflows
Fetch an explicit musrfit revision, compile and validate the scientific runtime, and upload its descriptor, archive, and diagnostics. Require a selected runtime workflow run for Linux packaging, verify restoration through the existing offline installer, and upload a complete package set without implicit release publishing.

Fix clean-container ROOT discovery, allow scoped CI container cleanup, support both fpm cache layouts, and cover artifact restoration and build contracts with regression tests.
2026-10-29 16:42:30 +01:00

100 lines
3.6 KiB
YAML

name: Build and package
on:
workflow_dispatch:
inputs:
runtime_run_id:
description: 'Run ID from a successful Build runtime workflow (not a job/task ID)'
required: true
permissions:
contents: read
actions: read
jobs:
build-package:
runs-on: ubuntu-latest-full
timeout-minutes: 120
defaults:
run:
shell: bash
env:
ELECTRON_SKIP_BINARY_DOWNLOAD: '1'
steps:
- name: Check out muSRFlow
uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
github-server-url: ${{ gitea.server_url }}
persist-credentials: false
- name: Check runtime selection
env:
RUNTIME_RUN_ID: ${{ inputs.runtime_run_id }}
run: |
[[ "$RUNTIME_RUN_ID" =~ ^[1-9][0-9]*$ ]] || { echo 'A numeric runtime workflow run ID is required' >&2; exit 1; }
- name: Download selected runtime
uses: https://github.com/actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: musrflow-runtime-linux-x64
path: runtime-download
run-id: ${{ inputs.runtime_run_id }}
repository: ${{ gitea.repository }}
github-token: ${{ secrets.GITEA_TOKEN }}
- name: Set up Node.js
uses: https://github.com/actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: '22.23.2'
- name: Install dependencies
run: npm ci --no-audit --no-fund
- name: Verify and restore runtime before packaging
run: |
set -euo pipefail
node scripts/ci-restore-runtime.js runtime-download .ci-runtime
# The installer exports RUNTIME_DIR for subsequent steps, not this shell.
- name: Validate restored scientific tools
run: bash packaging/runtime/validate-runtime.sh "$RUNTIME_DIR" --arch x64
- name: Run tests
run: npm run test:electron
- name: Build Linux application and runtime packages
run: |
set -euo pipefail
# Application packaging also populates the fpm/AppImage tool cache.
npx --yes electron-builder@26.15.3 --linux rpm AppImage --x64 --publish never
bash packaging/runtime/build-runtime-appimage.sh
bash packaging/runtime/build-runtime-rpm.sh
bash packaging/runtime/build-runtime-archive.sh
npm run checksums
- name: Collect complete package set
run: |
set -euo pipefail
version=$(node -p "require('./package.json').version")
mkdir -p artifacts
# Explicit files make partial builds fail rather than hiding missing output.
for file in "musrflow-$version-x86_64.rpm" "muSRFlow-$version-x86_64.AppImage" \
"musrflow-runtime-$version-x86_64.rpm" "musrflow-runtime-$version-x86_64.AppImage"; do
test -s "dist/$file"
cp "dist/$file" "dist/$file.md5" "dist/$file.sha256" artifacts/
done
cp -a dist/runtime-downloads artifacts/
cp "$RUNTIME_DIR/runtime-manifest.json" artifacts/
printf 'runtime_workflow_run=%s\nmuSRFlow=%s\n' "$RUNTIME_RUN_ID" "$(git rev-parse HEAD)" > artifacts/build-source.txt
env:
RUNTIME_RUN_ID: ${{ inputs.runtime_run_id }}
- name: Upload packages
uses: https://github.com/actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: musrflow-linux-packages
path: artifacts/
if-no-files-found: error
compression-level: 0
retention-days: 30