-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (53 loc) · 1.79 KB
/
deploy.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
name: Build and deploy site
on: [push]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-latest
env:
CI: true
CI_BUILD_DIR: out
steps:
- name: Check out main repository code
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
# Uses node version defined in engines
node-version-file: 'package.json'
- name: Restore cached node modules and build artifacts
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: |
~/.npm
node_modules
.cache
${{ env.CI_BUILD_DIR }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: (On cache miss) List the state of node modules
continue-on-error: true
run: npm list
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: (On cache miss) Install node modules
continue-on-error: true
run: npm ci
- name: Build site
run: npm run build
- name: Deploy to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_PAGES_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: ${{ vars.CLOUDFLARE_PROJECT_NAME }}
directory: ${{ env.CI_BUILD_DIR }}
gitHubToken: ${{ secrets.GITHUB_TOKEN }}