-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (53 loc) · 1.7 KB
/
build-and-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
60
61
62
63
name: build & deploy
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: setup node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: setup npm
run: |
./npm_use.sh &&
npm --version &&
npm list -g --depth 0
- name: install dependencies
run: npm ci
- name: get astro cache
id: astro-cache-build
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
with:
path: |
node_modules
.astro
key: ${{ runner.os }}-astro-cache-v2-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-astro-cache-v2-
- name: build
run: npm run build
- name: add indexNow key
env:
INDEXNOW_KEY: ${{ secrets.INDEXNOW_KEY }}
run: echo $INDEXNOW_KEY > dist/$INDEXNOW_KEY.txt
- name: deploy
uses: nwtgck/actions-netlify@4cbaf4c08f1a7bfa537d6113472ef4424e4eb654 # v3.0
with:
publish-dir: "./dist"
production-branch: main
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "Deploy from GitHub Actions"
enable-pull-request-comment: true
enable-commit-comment: true
overwrites-pull-request-comment: true
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 5