Merge pull request #404 from lFourl/chore/page-descriptions #202
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | |
on: | |
push: | |
branches: [ develop, release ] | |
jobs: | |
publish: | |
name: Publish | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Read `.nvmrc` | |
run: echo "::set-output name=nvmrc::$(cat .nvmrc)" | |
id: nvm | |
- name: Use Node.js (.nvmrc) | |
uses: actions/setup-node@v1 | |
with: | |
node-version: "${{ steps.nvm.outputs.nvmrc }}" | |
- name: Read `yarn cache dir` | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn config get cacheFolder)" | |
- name: Load yarn cache | |
uses: actions/cache@v2 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Load Next.js cache | |
uses: actions/cache@v2 | |
with: | |
path: ${{ github.workspace }}/dist/cache | |
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-nextjs- | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: Build | |
run: yarn build | |
env: | |
NODE_ENV: production | |
- name: Prepare artifact | |
run: | | |
tar -czf fuelrats-com.tar.gz \ | |
.config \ | |
.yarn/plugins \ | |
.yarn/releases \ | |
dist \ | |
public \ | |
scripts \ | |
.nvmrc \ | |
CHANGELOG.md \ | |
LICENSE \ | |
.yarnrc.yml \ | |
next.config.js \ | |
package.json \ | |
README.md \ | |
yarn.lock | |
- name: Publish artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: fuelrats-com | |
path: fuelrats-com.tar.gz | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
needs: publish | |
env: | |
NODE_ENV: production | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: fuelrats-com | |
- name: Extract artifact | |
run: | | |
tar -xzf fuelrats-com.tar.gz | |
rm fuelrats-com.tar.gz | |
- name: Read `.nvmrc` | |
run: echo "::set-output name=nvmrc::$(cat .nvmrc)" | |
id: nvm | |
- name: Use Node.js (.nvmrc) | |
uses: actions/setup-node@v1 | |
with: | |
node-version: "${{ steps.nvm.outputs.nvmrc }}" | |
- name: Read `yarn cache dir` | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn config get cacheFolder)" | |
- name: Load yarn cache | |
uses: actions/cache@v2 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: Install SSH key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.FR_SSH_KEY }} | |
known_hosts: ${{ secrets.FR_KNOWN_HOSTS }} | |
- name: Deploy | |
run: sh ./scripts/deploy.sh |