Skip to content

Deploy to GitHub Pages #43

Deploy to GitHub Pages

Deploy to GitHub Pages #43

Workflow file for this run

name: Deploy to GitHub Pages
on:
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v6
with:
ref: main
path: main
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 20
- name: Build all channels
run: |
set -euo pipefail
mkdir -p staging
# Read channels from main's release-channels.json
channels=$(cat main/release-channels.json)
count=$(echo "$channels" | jq length)
for i in $(seq 0 $(( count - 1 ))); do
name=$(echo "$channels" | jq -r ".[$i].name")
branch=$(echo "$channels" | jq -r ".[$i].branch")
path=$(echo "$channels" | jq -r ".[$i].path")
cast_id=$(echo "$channels" | jq -r ".[$i].castId")
echo "::group::Building channel: $name (branch: $branch, path: $path)"
# Checkout the channel branch
git clone --depth 1 --branch "$branch" \
"https://github.com/${{ github.repository }}.git" \
"channel-$name"
cd "channel-$name"
# Inject Cast ID into source files
sed -i "s/__CAST_APP_ID__/$cast_id/g" src/index.html
# Install dependencies and build
yarn install --frozen-lockfile
yarn build
# Copy build output to staging directory
if [ "$path" = "." ]; then
cp -r dist/* ../staging/
else
mkdir -p "../staging/$path"
cp -r dist/* "../staging/$path/"
fi
cd ..
echo "::endgroup::"
done
echo "Staging directory contents:"
find staging -type f | head -50
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: staging
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5