-
Notifications
You must be signed in to change notification settings - Fork 2
72 lines (64 loc) · 2.07 KB
/
build.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
name: Build Site
on:
push:
branches:
- master
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
- name: node_modules CI Cache
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
- name: Next.js CI Cache
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('src/**', 'contents/**') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- name: Install Dependencies
run: npm clean-install
- name: Build Site
run: npm run build && npm run export
- name: Upload Build Output to Artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: ${{ github.workspace }}/out/
if-no-files-found: error
deploy:
runs-on: ubuntu-latest
needs: [build]
strategy:
matrix:
include:
- host_id: REMOTE_HOST_SJC
fail-fast: false
env:
REMOTE_HOST: ${{ secrets[matrix.host_id] }}
steps:
- uses: actions/download-artifact@v3
with:
name: dist
path: ${{ github.workspace }}/out/
- run: ls -R ${{ github.workspace }}/out/
- uses: easingthemes/[email protected]
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
ARGS: '-avz --delete'
REMOTE_HOST: ${{ env.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
SOURCE: out/*
TARGET: /home/github/n.wtf/
EXCLUDE: .git,.github,.gitlab-ci.yml,.nojekyll