-
Notifications
You must be signed in to change notification settings - Fork 10
91 lines (86 loc) · 2.81 KB
/
Copy pathstatic.yml
File metadata and controls
91 lines (86 loc) · 2.81 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
# 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@v6
- name: Install pnpm
uses: pnpm/action-setup@v6.0.8
with:
package_json_file: website/package.json
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 22
cache: pnpm
cache-dependency-path: website/pnpm-lock.yaml
- name: Restore Astro build cache
uses: actions/cache@v4
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@v5
- 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: Upload artifact
if: github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v3
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@v5