morphit/.forgejo/workflows/offline-bundle.yml

74 lines
2.9 KiB
YAML

# Build the self-contained OFFLINE install tarball — on demand.
#
# Fires only when you click "Run workflow" (workflow_dispatch), NOT on release,
# so you can build and TEST the offline appliance before ever cutting a public
# release. The runner already has Docker (ci.yml uses `docker run`), so this
# needs no Docker on any of your own machines.
#
# Output: morphit-<version>-offline.tar.gz uploaded as a downloadable artifact.
# Download it, copy it to a machine with no internet, extract, and run the guided
# install — it installs everything (apt packages, Docker images, Node, Kubo) from
# the bundle with the network unplugged.
#
# NOTE ON SIZE: the artifact is large (~1-2 GB). If your Forgejo instance caps
# artifact size and this upload is rejected, switch the last step to attach the
# file to a draft pre-release instead (releases handle large assets); ask and
# we'll wire that variant.
name: morphit-offline-bundle
on:
workflow_dispatch: {}
concurrency:
group: morphit-offline-bundle-${{ github.ref }}
cancel-in-progress: true
jobs:
offline-bundle:
name: Build the offline install tarball
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install Node.js 22 LTS
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: '22'
- name: Install build tools (for native modules during npm ci)
run: |
set -eu
# Scope to base repos so a flaky third-party repo in the runner image
# can't fail this (Dir::Etc::sourceparts=- ignores sources.list.d); the
# retry rides out a brief base-mirror hiccup. Matches ci.yml/release.yml.
for i in 1 2 3; do
sudo apt-get update -qq \
-o Dir::Etc::sourceparts=- \
-o APT::Get::List-Cleanup=0 && break
echo "apt-get update attempt $i failed; retrying in 5s..."
sleep 5
done
sudo apt-get install -y --no-install-recommends build-essential python3 || true
- name: Build the offline bundle
# Assembles node_modules + vendor/{node,kubo,apt,docker} and packages
# morphit-<version>-offline.tar.gz + .sha256. Uses the runner's Docker
# daemon to pull + save the BunkerWeb and Postgres images.
run: |
set -eu
bash scripts/build-offline-bundle.sh
echo "── built ──"
ls -lh morphit-*-offline.tar.gz*
sha256sum -c morphit-*-offline.tar.gz.sha256
- name: Upload the offline tarball
uses: actions/upload-artifact@v3
with:
name: morphit-offline-bundle
path: |
morphit-*-offline.tar.gz
morphit-*-offline.tar.gz.sha256
retention-days: 7
if-no-files-found: error