Restore docs screenshots and publish Docusaurus site to git-pages
All checks were successful
ci / frontend-build (push) Successful in 43s
ci / backend-test (push) Successful in 1m18s
ci / build-1 (push) Successful in 2m34s
ci / frontend-docker (push) Successful in 0s
ci / docs (push) Successful in 3m26s
ci / build (push) Successful in 6m55s
ci / backend-docker (push) Successful in 0s
ci / build-2 (push) Successful in 45s
ci / chart (push) Successful in 0s
All checks were successful
ci / frontend-build (push) Successful in 43s
ci / backend-test (push) Successful in 1m18s
ci / build-1 (push) Successful in 2m34s
ci / frontend-docker (push) Successful in 0s
ci / docs (push) Successful in 3m26s
ci / build (push) Successful in 6m55s
ci / backend-docker (push) Successful in 0s
ci / build-2 (push) Successful in 45s
ci / chart (push) Successful in 0s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
7067bbb36f
commit
d3997a7bd6
4 changed files with 59 additions and 8 deletions
|
|
@ -6,8 +6,6 @@ on:
|
|||
tags: ['**']
|
||||
workflow_dispatch:
|
||||
|
||||
# The GitLab pipeline also took docs screenshots and published the Docusaurus site to GitLab Pages.
|
||||
# Forgejo has no built-in Pages, so those two jobs are not ported yet.
|
||||
jobs:
|
||||
backend-test:
|
||||
runs-on: default
|
||||
|
|
@ -24,6 +22,13 @@ jobs:
|
|||
cd backend
|
||||
go vet ./...
|
||||
go test ./...
|
||||
# Static binary for the docs screenshot job (sqlite is pure Go).
|
||||
go build -o ../pager .
|
||||
- uses: https://code.forgejo.org/forgejo/upload-artifact@v4
|
||||
with:
|
||||
name: pager-binary
|
||||
path: pager
|
||||
retention-days: 1
|
||||
|
||||
frontend-build:
|
||||
runs-on: default
|
||||
|
|
@ -38,6 +43,52 @@ jobs:
|
|||
cd frontend
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm build # no unit tests yet
|
||||
- uses: https://code.forgejo.org/forgejo/upload-artifact@v4
|
||||
with:
|
||||
name: frontend-dist
|
||||
path: frontend/dist
|
||||
retention-days: 1
|
||||
|
||||
# Starts the real backend with the built UI on a fresh sqlite database, fills it with demo data,
|
||||
# takes the docs screenshots, builds the Docusaurus site and publishes it to git-pages.
|
||||
docs:
|
||||
needs: [backend-test, frontend-build]
|
||||
runs-on: default
|
||||
container:
|
||||
image: mcr.microsoft.com/playwright:v1.65.1-noble
|
||||
env:
|
||||
NODE_OPTIONS: --experimental-sqlite # node:sqlite is used to backdate the demo alerts
|
||||
steps:
|
||||
- name: Install git and curl
|
||||
run: apt-get update -qq && apt-get install -y -qq git curl ca-certificates
|
||||
- uses: https://code.forgejo.org/actions/checkout@v7
|
||||
- uses: https://code.forgejo.org/forgejo/download-artifact@v4
|
||||
with:
|
||||
name: pager-binary
|
||||
- uses: https://code.forgejo.org/forgejo/download-artifact@v4
|
||||
with:
|
||||
name: frontend-dist
|
||||
path: frontend/dist
|
||||
- name: Screenshots
|
||||
run: |
|
||||
set -eu
|
||||
npm install -g pnpm
|
||||
chmod +x pager
|
||||
DB_DRIVER=sqlite DB_NAME=/tmp/pager.db PORT=8080 JWT_SECRET=ci STATIC_DIR=frontend/dist ./pager > backend.log 2>&1 &
|
||||
for i in $(seq 30); do curl -sf localhost:8080/api/health && break; sleep 1; done
|
||||
cd docs
|
||||
pnpm install --frozen-lockfile
|
||||
SQLITE_FILE=/tmp/pager.db BASE=http://localhost:8080 pnpm screenshots
|
||||
PAGES_URL=https://jonasled.jonasled.dev/pager/ pnpm build
|
||||
- name: Publish to git-pages
|
||||
if: github.ref_name == github.event.repository.default_branch
|
||||
env:
|
||||
GIT_PAGES_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
set -eu
|
||||
curl -fsSL -o git-pages-cli https://codeberg.org/git-pages/git-pages-cli/releases/download/v1.13.1/git-pages-cli.linux-amd64
|
||||
chmod +x git-pages-cli
|
||||
./git-pages-cli https://jonasled.jonasled.dev/pager/ --upload-dir docs/build
|
||||
|
||||
backend-docker:
|
||||
uses: infra/ci-snippets/.forgejo/workflows/docker-build.yml@master
|
||||
|
|
|
|||
|
|
@ -21,4 +21,4 @@ DB: `DB_DRIVER` = `postgres` | `mariadb` | `sqlite`, with single `DB_HOST/PORT/U
|
|||
Regenerate API docs after changing annotations: `cd backend && swag init --parseInternal -g main.go`
|
||||
|
||||
## Docs
|
||||
Docusaurus site in `docs/` (`cd docs && pnpm install && pnpm start`). Screenshots are not committed: they are taken with Playwright (`pnpm screenshots`) against the real app with demo data. The GitLab pipeline did this on every run and published the site to GitLab Pages; that is not ported to Forgejo yet.
|
||||
Docusaurus site in `docs/` (`cd docs && pnpm install && pnpm start`). Screenshots are not committed: they are taken with Playwright (`pnpm screenshots`) against the real app with demo data. The Forgejo Actions pipeline does this on every run and publishes the site to git-pages on the default branch: https://jonasled.jonasled.dev/pager/
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
// On GitLab Pages CI_PAGES_URL is the full site URL (maybe with a path), so the base URL needs no manual setting.
|
||||
const pages = process.env.CI_PAGES_URL ? new URL(process.env.CI_PAGES_URL) : null
|
||||
// The site is published to git-pages under a sub path; PAGES_URL overrides it.
|
||||
const pages = new URL(process.env.PAGES_URL || 'https://jonasled.jonasled.dev/pager/')
|
||||
|
||||
/** @type {import('@docusaurus/types').Config} */
|
||||
module.exports = {
|
||||
title: 'Pager',
|
||||
tagline: 'Multi-tenant alerting with Alertmanager, on-call UI and push notifications',
|
||||
url: pages ? pages.origin : 'http://localhost',
|
||||
baseUrl: pages ? pages.pathname.replace(/\/?$/, '/') : '/',
|
||||
url: pages.origin,
|
||||
baseUrl: pages.pathname.replace(/\/?$/, '/'),
|
||||
favicon: 'img/icon.svg',
|
||||
onBrokenLinks: 'throw',
|
||||
markdown: { hooks: { onBrokenMarkdownLinks: 'throw' } },
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
"platformAutomerge": true,
|
||||
"packageRules": [
|
||||
{
|
||||
"description": "The pages job's CI image ships a browser build tied to one exact Playwright npm version (documentation/package.json) — bump both together so they never drift out of sync.",
|
||||
"description": "The docs job's CI image ships a browser build tied to one exact Playwright npm version (documentation/package.json) — bump both together so they never drift out of sync.",
|
||||
"matchPackageNames": ["playwright", "mcr.microsoft.com/playwright"],
|
||||
"groupName": "playwright (docs screenshots)"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue