-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (83 loc) · 2.82 KB
/
gh-pages.yml
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
name: Publish to GitHub Pages
on:
push:
branches:
- main
schedule:
- cron: '15 0 * * *'
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: 'pages'
cancel-in-progress: false
defaults:
run:
shell: bash
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
with:
node-version: 18
- uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0
name: Install pnpm
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: pnpm install
run: pnpm install
- name: Update esbuild
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
run: |
LATEST=$(curl https://registry.npmjs.org/esbuild/latest | jq -r '.version')
if [[ -z "$LATEST" ]]; then
echo "Failed to get latest version"
exit 1
fi
if [[ "$LATEST" == "$(jq -r '.devDependencies.esbuild' package.json)" ]]; then
echo "Already up to date"
exit 0
fi
sed -i "s/\"esbuild\": \".*\"/\"esbuild\": \"$LATEST\"/" package.json
sed -i "s/\"@esbuild\/wasi-preview1\": \".*\"/\"@esbuild\/wasi-preview1\": \"$LATEST\"/" package.json
pnpm install --no-frozen-lockfile
pnpm vendor-esbuild
- name: Build
run: pnpm run build
- name: Commit update
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9
with:
message: Update esbuild
default_author: github_actions
- name: Setup Pages
id: pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5
- name: Upload artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
with:
path: ./dist
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4