-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (49 loc) · 1.62 KB
/
deploy-content.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: Update Post Content
on:
pull_request:
paths: ["content/**"]
types: [closed]
jobs:
deploy:
if: github.event.pull_request.merged && contains(github.event.pull_request.labels.*.name, 'update-content')
name: Update and deploy content
runs-on: ubuntu-latest
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
steps:
- name: Fetch all tags
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout to latest tags
run: git checkout $(git describe --tags $(git rev-list --tags --max-count=1))
- name: Get latest change in content directory from master branch
run: git checkout master content/
- name: Cache node modules
uses: actions/cache@v4
with:
path: ./node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node_modules-
- name: Cache netlify
uses: actions/cache@v4
with:
path: ./.netlify
key: ${{ runner.os }}-netlify-${{ hashFiles('**/netlify.toml') }}
restore-keys: |
${{ runner.os }}-netlify-
- name: Install NodeJS
uses: actions/setup-node@v4
with:
node-version: "18.x"
cache: "yarn"
- name: Install netlify cli
run: yarn global --ignore-optional add netlify-cli
- name: Install dependencies
run: yarn
- name: Build app
run: netlify build
- name: Deploy to netlify
run: netlify deploy --prod