Skip to content

Commit 7cd0a62

Browse files
bjohansebaswesleytodd
authored andcommitted
ci: use actions/cache and actions/deploy-pages
1 parent 3fa39bf commit 7cd0a62

File tree

1 file changed

+45
-9
lines changed

1 file changed

+45
-9
lines changed

.github/workflows/build.yml

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,52 @@
11
name: Index and build site
2-
on: push
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: read
9+
pages: write
10+
id-token: write
11+
12+
13+
concurrency:
14+
group: "pages"
15+
cancel-in-progress: false
16+
317
jobs:
4-
build:
18+
index:
19+
environment:
20+
name: github-pages
21+
url: ${{ steps.deployment.outputs.page_url }}
522
runs-on: ubuntu-latest
623
steps:
7-
- uses: actions/checkout@v1
8-
- name: Create GH Pages
9-
uses: pkgjs/gh-pages@master
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
- name: Setup Pages
27+
uses: actions/configure-pages@v5
28+
- uses: actions/setup-node@v4
1029
with:
11-
nojekyll: true
12-
repo: pkgjs/statusboard
13-
commit: pages build from ${{ github.sha }}
14-
build: npm i && npm run build
30+
node-version: 12
31+
- uses: actions/cache@v4
32+
id: cache
33+
with:
34+
path: |
35+
~/.npm
36+
~/.cache
37+
./dist
38+
./node_modules
39+
key: ${{ runner.os }}-build-${{ github.sha }}
40+
- if: steps.cache.outputs.cache-hit != 'true'
41+
run: npm install
42+
shell: bash
43+
- run: npm run build
1544
env:
1645
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
- name: Upload artifact
47+
uses: actions/upload-pages-artifact@v3
48+
with:
49+
path: './github-pages'
50+
- name: Deploy to GitHub Pages
51+
id: deployment
52+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)