ci / test (pull_request) Successful in 35s
seed lands a bundle built somewhere else, which meant building Havre on the Mac and carrying the bundle over. ship.yml clones the venture's source repo (private is fine: the time bot's token clones it, for that step only), runs its tools/build.sh on the runner (installing Chromium for the screenshots when the runner has no Chrome), and ship.py lands the bundle the build left with seed's own checks and commit. Nothing is built or carried outside the factory. test_ship.py runs in ci. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012sekpYMwTXuMdza1isMQA1
91 lines
3.9 KiB
YAML
91 lines
3.9 KiB
YAML
name: ship
|
|
# Ship a venture whose source lives in its own repo on Teahub: clone it, build it here, and land the result the way
|
|
# seed does (ventures/<slug>/ on gh-pages, its line in ventures/ventures.json, served at <slug>.yolopreneur.lol).
|
|
# Actions -> ship -> Run workflow. Nothing is built or carried outside the factory.
|
|
# The source repo can be private: the `time` bot's token clones it, for that one step, and isn't kept. Its build is
|
|
# `tools/build.sh OUT`, which leaves OUT/<slug>.tgz with <slug>/ at the top; Chrome for its screenshots comes from
|
|
# CHROME (Playwright's Chromium is installed when the runner has none), with CHROME_FLAGS for running as root.
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
repo:
|
|
description: "The venture's source repo on Teahub, owner/repo"
|
|
required: true
|
|
type: string
|
|
slug:
|
|
description: "Folder and subdomain: ventures/<slug>/ is served at <slug>.yolopreneur.lol"
|
|
required: true
|
|
type: string
|
|
ref:
|
|
description: "Branch, tag or commit to build (empty: the repo's default branch)"
|
|
required: false
|
|
type: string
|
|
name:
|
|
description: "Name in the ledger (needed for a new venture)"
|
|
required: false
|
|
type: string
|
|
one_liner:
|
|
description: "One line in the ledger (needed for a new venture)"
|
|
required: false
|
|
type: string
|
|
permissions:
|
|
contents: write
|
|
concurrency:
|
|
group: venture # the venture loop and seed write gh-pages too: take turns
|
|
cancel-in-progress: false
|
|
jobs:
|
|
ship:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
repository: ${{ inputs.repo }}
|
|
ref: ${{ inputs.ref }}
|
|
token: ${{ secrets.TIME_TOKEN }}
|
|
path: src
|
|
persist-credentials: false # the build that runs next must not find the token in .git/config
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
- name: find Chrome, or install Playwright's Chromium
|
|
run: |
|
|
set -eu
|
|
for c in google-chrome google-chrome-stable chromium chromium-browser; do
|
|
if command -v "$c" >/dev/null 2>&1; then
|
|
echo "CHROME=$(command -v "$c")" >> "$GITHUB_ENV"; echo "using $(command -v "$c")"; exit 0
|
|
fi
|
|
done
|
|
echo "no Chrome on this runner: installing Playwright's Chromium"
|
|
npx -y playwright@1.55.0 install --with-deps chromium > /tmp/pw.log 2>&1 || { tail -20 /tmp/pw.log; exit 1; }
|
|
c=$(find "$HOME/.cache/ms-playwright" -type f -name chrome -path '*chrome-linux*' | head -1)
|
|
[ -n "$c" ] && [ -x "$c" ] || { echo "::error::no Chromium after the install"; exit 1; }
|
|
echo "CHROME=$c" >> "$GITHUB_ENV"; echo "using $c"
|
|
- name: build
|
|
working-directory: src
|
|
env: # inputs reach the scripts through the environment, never interpolated into them
|
|
REPO: ${{ inputs.repo }}
|
|
CHROME_FLAGS: "--no-sandbox --disable-dev-shm-usage --disable-gpu"
|
|
run: |
|
|
set -eu
|
|
sh tools/build.sh "$GITHUB_WORKSPACE/out"
|
|
echo "SOURCE=$REPO@$(git rev-parse --short HEAD)" >> "$GITHUB_ENV"
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
sparse-checkout: .github/time
|
|
path: engine
|
|
persist-credentials: false
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
ref: gh-pages
|
|
path: pages
|
|
fetch-depth: 1
|
|
- name: land
|
|
env:
|
|
SLUG: ${{ inputs.slug }}
|
|
NAME: ${{ inputs.name }}
|
|
ONE_LINER: ${{ inputs.one_liner }}
|
|
run: BUNDLE_FILE="$GITHUB_WORKSPACE/out/$SLUG.tgz" python3 engine/.github/time/ship.py pages
|
|
- name: tell Teahub pages to pull
|
|
run: curl -fsS -X POST "https://yolopreneur.lol/_hook/${GITHUB_REPOSITORY}" || echo "pages pulls by itself within five minutes"
|