mirror of
https://github.com/oSoWoSo/DistroHopper.git
synced 2026-12-06 04:43:46 +00:00
101 lines
2.9 KiB
YAML
101 lines
2.9 KiB
YAML
name: Build and deploy website
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
reuse_matrix_metadata:
|
|
description: Reuse public metadata from this run's distro diagnostic artifacts
|
|
type: boolean
|
|
default: false
|
|
secrets:
|
|
SURFER_USER:
|
|
required: true
|
|
SURFER_TOKEN:
|
|
required: true
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
# Do not interrupt an upload or allow two runs to publish concurrently.
|
|
concurrency:
|
|
group: "website-surfer"
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
SURFER_SERVER: https://dh.osowoso.org
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
|
|
- name: Validate Surfer deployment settings
|
|
env:
|
|
SURFER_USER: ${{ secrets.SURFER_USER }}
|
|
SURFER_TOKEN: ${{ secrets.SURFER_TOKEN }}
|
|
run: |
|
|
for name in SURFER_SERVER SURFER_USER SURFER_TOKEN; do
|
|
if [ -z "${!name}" ]; then
|
|
echo "::error::Missing ${name}. See docs/website-deployment.md for deployment settings and secrets."
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
- name: Install build dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y pandoc curl jq
|
|
|
|
- name: Set up Node for Surfer CLI
|
|
uses: actions/setup-node@v7
|
|
with:
|
|
node-version: '24'
|
|
|
|
- name: Install Surfer CLI
|
|
run: npm install --global @cloudron/surfer@7.2.0
|
|
|
|
- name: Download matrix metadata
|
|
if: inputs.reuse_matrix_metadata
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
pattern: diagnostics-*
|
|
path: ${{ runner.temp }}/distro-diagnostics
|
|
|
|
- name: Reuse matrix metadata
|
|
if: inputs.reuse_matrix_metadata
|
|
env:
|
|
METADATA_ARTIFACT_DIR: ${{ runner.temp }}/distro-diagnostics
|
|
run: |
|
|
mkdir -p public
|
|
for metadata in "$METADATA_ARTIFACT_DIR"/diagnostics-*/public; do
|
|
[ ! -d "$metadata" ] || cp -a "$metadata/." public/
|
|
done
|
|
|
|
- name: Generate distro metadata for standalone runs
|
|
if: ${{ !inputs.reuse_matrix_metadata }}
|
|
timeout-minutes: 60
|
|
run: |
|
|
mkdir -p public TODO
|
|
./generate --parallel
|
|
|
|
- name: Validate distro metadata
|
|
run: |
|
|
if ! grep -ql '^OSNAME=' public/*; then
|
|
echo "::error::No supported distro metadata was generated"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Build website
|
|
run: ./web-deploy --build
|
|
|
|
- name: Update website branch from the built site
|
|
run: bash scripts/publish-website-branch website
|
|
|
|
- name: Deploy website to Cloudron Surfer
|
|
timeout-minutes: 20
|
|
env:
|
|
SURFER_USER: ${{ secrets.SURFER_USER }}
|
|
SURFER_TOKEN: ${{ secrets.SURFER_TOKEN }}
|
|
SURFER_MESSAGE: DistroHopper ${{ github.sha }}
|
|
run: ./web-deploy --surfer
|