-
Notifications
You must be signed in to change notification settings - Fork 2
86 lines (74 loc) · 2.22 KB
/
deploy-next.yml
File metadata and controls
86 lines (74 loc) · 2.22 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
name: Deploy to Next
on:
push:
branches:
- main
# https://github.com/ouzi-dev/commit-status-updater/tree/v2/#workflow-permissions
permissions:
contents: read
statuses: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 21
- name: Cache npm
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Set deployment status
uses: ouzi-dev/commit-status-updater@v2
with:
name: Deploy
status: pending
description: Preparing deploy
- name: Install
run: npm ci
- name: Build
run: npm run build
env:
PUBLIC_GOOGLE_ANALYTICS: ${{ secrets.NEXT_PUBLIC_GOOGLE_ANALYTICS }}
DEPLOYMENT_NAME: 'Next'
- name: Deploy
if: success()
uses: jakejarvis/s3-sync-action@v0.5.1
with:
args: --delete
env:
AWS_S3_BUCKET: ${{ vars.NEXT_BUCKET_NAME }}
AWS_ACCESS_KEY_ID: ${{ secrets.NEXT_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.NEXT_SECRET }}
AWS_REGION: ${{ vars.NEXT_REGION }}
SOURCE_DIR: .vitepress/dist
- name: Set success deployment status
if: success()
uses: ouzi-dev/commit-status-updater@v2
with:
name: Deploy
status: success
description: Deploy ready
url: ${{ vars.NEXT_URL }}
- name: Set failed deployment status
if: failure()
uses: ouzi-dev/commit-status-updater@v2
with:
name: Deploy
status: failure
description: Failed to deploy
- name: Invalidate CloudFront
uses: chetan/invalidate-cloudfront-action@v2
env:
DISTRIBUTION: ${{ vars.NEXT_DISTRIBUTION }}
PATHS: "/ /*"
AWS_REGION: ${{ vars.NEXT_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.NEXT_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.NEXT_SECRET }}