Node 20 actions are deprecated and forced onto Node 24 with warnings on every job. Bump actions/checkout v4->v7, actions/upload-artifact v4->v7 and softprops/action-gh-release v2->v3; none of these workflows use inputs whose behavior changed. download-artifact, setup-emsdk and freebsd-vm already run current runtimes.
133 lines
4.3 KiB
YAML
133 lines
4.3 KiB
YAML
name: Netlify
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: netlify-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
name: Build Site
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v7
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Install Packages
|
|
run: |
|
|
set -euo pipefail
|
|
sudo apt-get update
|
|
sudo apt-get install -y build-essential cmake cmark zlib1g-dev zip
|
|
- name: Set Up Emscripten
|
|
run: |
|
|
set -euo pipefail
|
|
git clone --depth 1 https://github.com/emscripten-core/emsdk.git "$HOME/emsdk"
|
|
"$HOME/emsdk/emsdk" install latest
|
|
"$HOME/emsdk/emsdk" activate latest
|
|
echo "EMSDK=$HOME/emsdk" >> "$GITHUB_ENV"
|
|
echo "EM_CONFIG=$HOME/emsdk/.emscripten" >> "$GITHUB_ENV"
|
|
echo "$HOME/emsdk" >> "$GITHUB_PATH"
|
|
echo "$HOME/emsdk/upstream/emscripten" >> "$GITHUB_PATH"
|
|
- name: Build Site
|
|
run: |
|
|
set -euo pipefail
|
|
make docs-site CMAKE=/usr/bin/cmake SITE_BUILD_DIR=build/site
|
|
test -f build/site/index.html
|
|
test -f build/site/api.html
|
|
test -f build/site/ide.html
|
|
test -f build/site/ide.js
|
|
test -f build/site/ide-tools/k2ir.js
|
|
test -f build/site/ide-tools/k2ir.wasm
|
|
test -f build/site/ide-tools/k2b.js
|
|
test -f build/site/ide-tools/k2b.wasm
|
|
test -f build/site/icons/kryon.png
|
|
test -f build/site/icons/c.png
|
|
test ! -f build/site/API.md
|
|
|
|
- name: Upload Site Artifact
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: kryon-site
|
|
path: build/site
|
|
if-no-files-found: error
|
|
|
|
deploy-preview:
|
|
name: Deploy Preview
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
if: github.event_name == 'pull_request'
|
|
|
|
steps:
|
|
- name: Download Site Artifact
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: kryon-site
|
|
path: build/site
|
|
|
|
- name: Install Netlify CLI
|
|
run: npm install --global netlify-cli
|
|
|
|
- name: Deploy Preview To Netlify
|
|
run: |
|
|
set -euo pipefail
|
|
auth_token="$(printf '%s' "$NETLIFY_AUTH_TOKEN" | tr -d '\r\n')"
|
|
site_id="$(printf '%s' "$NETLIFY_SITE_ID" | tr -d '\r\n')"
|
|
test -n "$auth_token" || { echo "::error::NETLIFY_AUTH_TOKEN is empty or missing"; exit 1; }
|
|
test -n "$site_id" || { echo "::error::NETLIFY_SITE_ID is empty or missing; use the Netlify Site ID, not the site URL"; exit 1; }
|
|
netlify deploy \
|
|
--no-build \
|
|
--dir build/site \
|
|
--alias "pr-${{ github.event.pull_request.number }}" \
|
|
--message "Preview ${{ github.event.pull_request.number }}" \
|
|
--auth "$auth_token" \
|
|
--site "$site_id"
|
|
env:
|
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
|
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
|
|
|
deploy-production:
|
|
name: Deploy Production
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
|
|
|
|
steps:
|
|
- name: Download Site Artifact
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: kryon-site
|
|
path: build/site
|
|
|
|
- name: Install Netlify CLI
|
|
run: npm install --global netlify-cli
|
|
|
|
- name: Deploy Production To Netlify
|
|
run: |
|
|
set -euo pipefail
|
|
auth_token="$(printf '%s' "$NETLIFY_AUTH_TOKEN" | tr -d '\r\n')"
|
|
site_id="$(printf '%s' "$NETLIFY_SITE_ID" | tr -d '\r\n')"
|
|
test -n "$auth_token" || { echo "::error::NETLIFY_AUTH_TOKEN is empty or missing"; exit 1; }
|
|
test -n "$site_id" || { echo "::error::NETLIFY_SITE_ID is empty or missing; use the Netlify Site ID, not the site URL"; exit 1; }
|
|
netlify deploy \
|
|
--no-build \
|
|
--dir build/site \
|
|
--prod \
|
|
--message "Production ${{ github.sha }}" \
|
|
--auth "$auth_token" \
|
|
--site "$site_id"
|
|
env:
|
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
|
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|