Repository navigation
108 lines (102 loc) · 3.93 KB
/
Copy pathpages.yml
File metadata and controls
108 lines (102 loc) · 3.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Web version
# Publishes the web interface to GitHub Pages at https://sanskarin.github.io/RepoDNA/, and the
# documentation at https://sanskarin.github.io/RepoDNA/docs/.
# It needs GitHub Pages turned on once: Settings > Pages > Build and deployment >
# Source: GitHub Actions. With "Deploy from a branch" instead, GitHub's own Pages build
# publishes the repository's files over the interface on every push; this workflow then
# publishes the interface again as soon as that build finishes.
on:
push:
branches: [main]
paths:
- apps/web/**
- packages/**
- package.json
- package-lock.json
# The analysis the web version runs as WebAssembly.
- crates/**
- Cargo.toml
- Cargo.lock
# The documentation: the guides, the project's own pages, and the site's builder.
- docs/**
- "*.md"
- examples/**
- benchmarks/README.md
- fixtures/README.md
- packaging/docs/**
- LICENSE
- NOTICE
- THIRD-PARTY-NOTICES.txt
- .github/workflows/pages.yml
# GitHub's own Pages build, which runs when Pages deploys from a branch. Its runs are
# titled "pages build and deployment", so both names are listed.
workflow_run:
workflows: [pages-build-deployment, pages build and deployment]
types: [completed]
workflow_dispatch:
permissions:
contents: read
# One deployment at a time; a newer push waits instead of cancelling a deployment.
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
name: Build
# After GitHub's own Pages build, only when it published something.
if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 22
cache: npm
- run: npm ci
# RepoDNA's analysis as WebAssembly, with which the web version analyzes a folder or
# an archive in the browser.
# No build cache in a job that publishes.
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-wasip1
- run: cargo build --locked -p repodna-wasm --target wasm32-wasip1 --profile web-engine
- run: npm run build -w @repodna/web
env:
REPODNA_ENGINE: target/wasm32-wasip1/web-engine/repodna-wasm.wasm
# The documentation, beside the web version. A broken link fails the build.
- run: node packaging/docs/build.mjs --out apps/web/dist/docs --check
# Make the published source SHA and Actions run independently inspectable.
# Only these public fields enter the site; never export the full environment.
- name: Stamp published source provenance
run: node packaging/docs/stamp-deployment.mjs apps/web/dist
- uses: actions/upload-pages-artifact@v5
with:
path: apps/web/dist
deploy:
name: Deploy
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v5
# A warning on the run, until the setting that lets GitHub's own build replace the
# interface is changed.
- name: Check the Pages source
env:
GH_TOKEN: ${{ github.token }}
run: |
source=$(gh api "repos/$GITHUB_REPOSITORY/pages" --jq .build_type) || {
echo "::notice::Could not read the GitHub Pages settings."
exit 0
}
if [ "$source" != workflow ]; then
message="GitHub Pages deploys from a branch, so every push to main briefly replaces the web version with the repository's files. Set Settings > Pages > Build and deployment > Source to GitHub Actions."
echo "::warning title=GitHub Pages source::$message"
echo "$message" >> "$GITHUB_STEP_SUMMARY"
fi