Build and deploy StartOS package / build (push) Failing after 11s
101 lines
2.7 KiB
YAML
101 lines
2.7 KiB
YAML
name: Build and deploy StartOS package
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- 'v*.*.*_*'
|
|
workflow_dispatch:
|
|
inputs:
|
|
deploy:
|
|
description: Install the built package on StartOS
|
|
required: false
|
|
default: false
|
|
type: boolean
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: npm
|
|
|
|
- name: Verify runner prerequisites
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
for command in docker jq make mksquashfs npm start-cli; do
|
|
command -v "${command}" >/dev/null || {
|
|
echo "Missing runner prerequisite: ${command}" >&2
|
|
exit 1
|
|
}
|
|
done
|
|
|
|
docker info >/dev/null
|
|
|
|
- name: Restore package signing key
|
|
env:
|
|
S9PK_BUILD_KEY_BASE64: ${{ secrets.S9PK_BUILD_KEY_BASE64 }}
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
: "${S9PK_BUILD_KEY_BASE64:?S9PK_BUILD_KEY_BASE64 is required}"
|
|
|
|
workspace_dir="$(dirname "${GITHUB_WORKSPACE}")"
|
|
install -d -m 700 "${workspace_dir}/.startos"
|
|
printf '%s' "${S9PK_BUILD_KEY_BASE64}" \
|
|
| base64 --decode \
|
|
> "${workspace_dir}/.startos/build.key.pem"
|
|
chmod 600 "${workspace_dir}/.startos/build.key.pem"
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Validate release tag
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
run: ./scripts/check-release-version.sh "${GITHUB_REF_NAME}"
|
|
|
|
- name: Build x86_64 package
|
|
run: make x86
|
|
|
|
- name: Verify package manifest
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
test -s todo-back_x86_64.s9pk
|
|
start-cli s9pk inspect todo-back_x86_64.s9pk manifest
|
|
sha256sum todo-back_x86_64.s9pk
|
|
|
|
# Gitea currently works most consistently with the v3 artifact protocol.
|
|
- name: Upload workflow artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: todo-back-x86_64-${{ github.sha }}
|
|
path: todo-back_x86_64.s9pk
|
|
if-no-files-found: error
|
|
retention-days: 14
|
|
|
|
- name: Install release on StartOS
|
|
if: startsWith(github.ref, 'refs/tags/') || github.event.inputs.deploy == 'true'
|
|
env:
|
|
STARTOS_HOST: ${{ secrets.STARTOS_HOST }}
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
: "${STARTOS_HOST:?STARTOS_HOST is required}"
|
|
start-cli \
|
|
--host "${STARTOS_HOST}" \
|
|
package install \
|
|
--sideload todo-back_x86_64.s9pk
|