forked from package-url/packageurl-js
-
Notifications
You must be signed in to change notification settings - Fork 2
96 lines (87 loc) · 3.37 KB
/
pages.yml
File metadata and controls
96 lines (87 loc) · 3.37 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
name: 📘 Walkthrough (GH Pages)
# Deploys the walkthrough pilot to https://socketdev.github.io/socket-packageurl-js/
# Trigger: push to main that touches walkthrough sources (plus manual).
#
# Uses the SocketDev/socket-registry shared composite action for
# checkout + Node/pnpm setup + install, so toolchain versions stay in
# sync with the rest of the fleet. The build/deploy steps are custom
# because there isn't a shared Pages workflow yet (worth PR'ing to
# socket-registry once we've shipped this and validated the pattern).
#
# Build model:
# 1. Shared setup-and-install → checkout w/ submodules, pnpm install.
# 2. `pnpm walkthrough --minify --base-path=/socket-packageurl-js generate walkthrough.json`
# The --base-path flag rewrites root-relative asset URLs and Val-Town
# part links (/<slug>/part/<n>) into prefixed flat HTML paths so the
# output works at socketdev.github.io/socket-packageurl-js/. --minify
# runs esbuild on JS + lightningcss on CSS (~49% on-disk reduction).
# 3. Upload `walkthrough/` as the Pages artifact.
# 4. Deploy via actions/deploy-pages.
on:
push:
branches: [main]
paths:
- 'walkthrough.json'
- 'walkthrough-comments.js'
- 'walkthrough-drag.js'
- 'walkthrough-overrides.css'
- 'walkthrough-sw.js'
- 'scripts/walkthrough.mts'
- 'src/**'
- 'assets/favicon/**'
- '.github/workflows/pages.yml'
- 'package.json'
- 'pnpm-lock.yaml'
workflow_dispatch:
# Default workflow-level permissions are read-only. Each job opts in
# to the narrower scope it needs — build doesn't touch Pages at all
# (just uploads an artifact), deploy gets pages + id-token.
permissions:
contents: read
# Queue Pages deploys serially — don't cancel a running deploy with a
# newer commit (`cancel-in-progress: false`), that can leave the site
# in a half-deployed state.
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
name: Build walkthrough
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Setup and install (checkout + Node + pnpm + install)
uses: SocketDev/socket-registry/.github/actions/setup-and-install@d7b5d15a9be8973a5715459d12b9a033603a5ff5 # main
with:
checkout-fetch-depth: '1'
# The fleet's shared checkout action doesn't init submodules.
# We need upstream/meander because the generate step shells out
# to its CLI. Init non-recursively at the pinned commit the
# superrepo points at — no re-resolving from meander upstream.
- name: Init meander submodule
run: git submodule update --init --depth=1 upstream/meander
- name: Generate walkthrough (minified, base-path=/socket-packageurl-js)
run: >
pnpm walkthrough
--minify
--base-path=/socket-packageurl-js
generate walkthrough.json
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: walkthrough
deploy:
name: Deploy to Pages
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- name: Deploy
id: deploy
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0