-
Notifications
You must be signed in to change notification settings - Fork 20
74 lines (62 loc) · 2.07 KB
/
preview_aws.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
73
74
name: Build and deploy to preview
on:
repository_dispatch:
types: dev-deploy
push:
branches:
- preview
workflow_dispatch:
env:
NODE_OPTIONS: '--max_old_space_size=8192'
jobs:
build:
runs-on: 'ubuntu-latest'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v3
with:
ref: 'preview'
- name: update submodules
run: |
git submodule init
git submodule update --remote
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Caching yarn
uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
${{ runner.os }}-yarn-
# - name: Caching Gatsby
# id: gatsby-cache-build
# uses: actions/cache@v2
# with:
# path: |
# public
# .cache
# key: ${{ runner.os }}-gatsby-build-preview-${{ github.run_id }}
# restore-keys: |
# ${{ runner.os }}-gatsby-build-preview
- name: Installing dependencies
run: yarn install
- name: Building Gatsby site
run: yarn build
env:
MSERVICE_URL: ${{ secrets.MSERVICE_URL }}
IS_PREVIEW: preview
# env:
# GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES: true
# CI: true
- name: Sync files
run: |
echo ${{ secrets.RSYNC_PASSWORD }} > rsync.pass
sudo chmod 600 rsync.pass
sudo chown root rsync.pass
sudo rsync --password-file=rsync.pass -rDvpzc --delete public/ rsync://${{secrets.PREVIEW_SITE}}