Repository navigation
95 lines (90 loc) · 3.33 KB
/
Copy pathstatic.yml
File metadata and controls
95 lines (90 loc) · 3.33 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
# Workflow for building and deploying the Astro/Starlight site to GitHub Pages
name: Deploy site to Pages
on:
push:
branches: ["main"]
paths:
- "website/**"
- ".github/workflows/static.yml"
pull_request:
branches: ["main"]
paths:
- "website/**"
- ".github/workflows/static.yml"
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages-${{ github.ref }}"
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: website
steps:
- name: Checkout
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
- name: Install pnpm
uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
with:
package_json_file: website/package.json
- name: Setup Node
uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version: 22
cache: pnpm
cache-dependency-path: website/pnpm-lock.yaml
- name: Restore Astro build cache
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
# Only the persistent data store is cached. `website/.astro` holds
# generated content-collection modules that import source files by
# name, so restoring it through the loose restore-keys below — which
# match a different source tree by design — resurrects imports for
# files that have since been renamed or deleted, and the build fails
# resolving them.
path: |
website/node_modules/.astro
key: astro-${{ runner.os }}-${{ hashFiles('website/pnpm-lock.yaml') }}-${{ hashFiles('website/src/**') }}
restore-keys: |
astro-${{ runner.os }}-${{ hashFiles('website/pnpm-lock.yaml') }}-
astro-${{ runner.os }}-
- name: Install dependencies
run: pnpm install --frozen-lockfile --prefer-offline
- name: Test site plugins
run: pnpm test
- name: Setup Pages
id: pages
if: github.ref == 'refs/heads/main'
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
- name: Build site
env:
# The Pages API can report an isolated hostname instead of the public URL.
# Use the public project URL for both pull-request and production builds.
SITE: https://microsoft.github.io
BASE_PATH: /scope
run: pnpm run build
- name: Install accessibility test browser
run: pnpm exec playwright install --with-deps chromium
- name: Test website accessibility and privacy links
run: pnpm exec playwright test
- name: Upload artifact
if: github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
with:
path: ./website/dist
deploy:
needs: build
if: github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1