Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Github Action for deploying https://www.mysaffronapp.com/ website
name: web-deploy
on:
push:
tags:
- "web-*"
- "both-*"
jobs:
landing:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: yarn --version
- run: rm packages/{app,clipper,widget,server,web,docs,common,controllers}/package.json
- run: yarn install --frozen-lockfile
- run: cd packages/landing && yarn build
- name: Upload public
uses: actions/upload-artifact@v1
with:
name: public
path: packages/landing/public
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: rm packages/{app,clipper,widget,server,web,landing,common,controllers}/package.json
- run: yarn install --frozen-lockfile
- run: cd packages/docs && yarn build
- run: cd packages/docs && mv build docs-build
- name: Upload build
uses: actions/upload-artifact@v1
with:
name: docs-build
path: packages/docs/docs-build
web:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: rm packages/{app,clipper,widget,server,landing,docs}/package.json
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
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-
- run: yarn install --frozen-lockfile
- run: yarn build
- run: cd packages/web && yarn build
- name: Upload build
uses: actions/upload-artifact@v1
with:
name: web-build
path: packages/web/build
upload:
runs-on: ubuntu-latest
needs: [web, docs, landing]
steps:
- name: Download landing
uses: actions/download-artifact@v1
with:
name: public
- name: Download docs
uses: actions/download-artifact@v1
with:
name: docs-build
- name: Download web
uses: actions/download-artifact@v1
with:
name: web-build
- run: mv web-build public/cra
- run: mv docs-build public/docs
- run: yarn init -y
- run: yarn add netlify-cli
- name: Send to Netlify
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
run: npx netlify deploy --dir=./public -p -m $GITHUB_REF --auth $NETLIFY_AUTH_TOKEN --site $NETLIFY_SITE_ID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment