Repository navigation
rebuild: openartifact/openartifact@4835d0a (main) #191
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SPDX-FileCopyrightText: The OpenArtifact Authors | |
| # | |
| # SPDX-License-Identifier: AGPL-3.0-or-later | |
| # Builds https://openartifact.github.io/: the landing page, the docs of the newest | |
| # release of openartifact/openartifact (/latest/), of main (/dev/, unreleased) and of | |
| # the newest stable tag of each older minor line among the last 5 (/vX.Y/), then | |
| # publishes them to GitHub Pages. A broken /dev/ or older version is reported and left | |
| # out; it never keeps the rest from being published. | |
| name: Pages | |
| on: | |
| push: | |
| # `rebuild` receives a trigger commit (force-pushed with a deploy key) from | |
| # openartifact/openartifact's docs-site-trigger.yml on docs changes and tags. | |
| branches: [main, rebuild] | |
| # Fallback poll: a run rebuilds only when docs/ of openartifact/openartifact changed or a | |
| # release tag appeared (see the check job); no secret is needed for that. | |
| schedule: | |
| - cron: "*/15 * * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| # One deployment at a time; a queued run is never cancelled mid-publish. | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| env: | |
| BUN_VERSION: "1.4.4" | |
| jobs: | |
| check: | |
| name: check for changes | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| outputs: | |
| changed: ${{ steps.diff.outputs.changed }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - id: diff | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| EVENT: ${{ github.event_name }} | |
| run: | | |
| # Pushes and manual runs always rebuild; only the poll compares. | |
| if [ "$EVENT" != "schedule" ]; then | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| wanted=$(scripts/fingerprint.sh) | |
| # Pages caches files for 10 minutes: ask for a fresh copy so a deploy that just | |
| # finished is not mistaken for an old one. | |
| deployed=$(curl -fsS -H 'Cache-Control: no-cache' "https://openartifact.github.io/source.txt?t=$(date +%s)" || true) | |
| echo "wanted=$wanted deployed=$deployed" | |
| if [ "$wanted" = "$deployed" ]; then | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| build: | |
| name: build | |
| needs: check | |
| if: needs.check.outputs.changed == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Check out openartifact/openartifact (docs source, all tags) | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| repository: openartifact/openartifact | |
| path: oa | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| persist-credentials: false | |
| - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 | |
| with: | |
| bun-version: ${{ env.BUN_VERSION }} | |
| # Taken from the checkout before the build, so a docs commit that lands while | |
| # the build runs is not recorded as published: the next poll sees it and rebuilds. | |
| - name: Fingerprint the docs source | |
| run: scripts/fingerprint.sh oa > "$RUNNER_TEMP/source.txt" | |
| - run: bun install --frozen-lockfile | |
| - run: bun test scripts | |
| env: | |
| OA_SRC_DIR: oa | |
| - name: Build landing page and docs | |
| run: bun run build --oa oa | |
| # Reports broken links and anchors as warnings; a PR to this repository | |
| # (ci.yml) is where they fail. | |
| - name: Check links and anchors | |
| run: bun scripts/check-links.ts _site --known scripts/known-broken-links.txt --warn '*' | |
| - name: Record what the site was built from | |
| run: cp "$RUNNER_TEMP/source.txt" _site/source.txt | |
| - uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 | |
| with: | |
| path: _site | |
| deploy: | |
| name: deploy | |
| needs: build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| permissions: | |
| pages: write # publish the artifact | |
| id-token: write # prove the deployment comes from this workflow | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - id: deployment | |
| uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1 |