-
Notifications
You must be signed in to change notification settings - Fork 20
68 lines (56 loc) · 1.89 KB
/
master_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
name: Build and deploy to prod
on:
repository_dispatch:
types: prod-deploy
push:
branches:
- master
workflow_dispatch:
env:
NODE_OPTIONS: "--max_old_space_size=8196"
jobs:
build:
runs-on: "ubuntu-latest"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v3
- 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-master-${{ github.run_id }}
# restore-keys: |
# ${{ runner.os }}-gatsby-build-master
- name: Installing dependencies
run: yarn install
- name: Building Gatsby site
run: yarn build --log-pages
env:
MSERVICE_URL: ${{ secrets.MSERVICE_URL }}
- 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.PROD_SITE}}