Skip to content

prod-deploy

prod-deploy #2826

Workflow file for this run

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}}