2021-07-17 14:21:58 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
#branches:
|
|
|
|
# master
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
env:
|
|
|
|
NODE_VERSION: 16
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
setup:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Setup
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-node@v2
|
|
|
|
id: node-setup
|
|
|
|
with:
|
|
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
|
|
- uses: actions/cache@v2
|
|
|
|
id: cache-restore
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
.yarn
|
|
|
|
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }}
|
|
|
|
- name: Install dependencies
|
|
|
|
if: steps.cache-restore.outputs.cache-hit != 'true'
|
2021-07-17 14:23:22 +00:00
|
|
|
run: yarn
|
2021-07-17 14:21:58 +00:00
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Build
|
|
|
|
needs: setup
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-node@v2
|
|
|
|
id: node-setup
|
|
|
|
with:
|
|
|
|
node-version: ${{ env.NODE_VERSION }}
|
2021-07-17 14:44:05 +00:00
|
|
|
- name: Yarn cache
|
|
|
|
uses: actions/cache@v2
|
2021-07-17 14:44:46 +00:00
|
|
|
id: yarn-cache-restore
|
2021-07-17 14:26:49 +00:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
.yarn
|
|
|
|
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }}
|
2021-07-17 14:44:05 +00:00
|
|
|
- name: Parcel cache
|
|
|
|
uses: actions/cache@v2
|
2021-07-17 14:44:46 +00:00
|
|
|
id: parcel-cache-restore
|
2021-07-17 14:44:05 +00:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
.parcel-cache
|
|
|
|
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }}-parcel
|
2021-07-17 14:28:35 +00:00
|
|
|
- run: |
|
2021-07-17 14:30:16 +00:00
|
|
|
yarn
|
|
|
|
yarn build
|
2021-07-17 14:44:05 +00:00
|
|
|
- name: Build Artifacts
|
2021-07-17 14:46:10 +00:00
|
|
|
uses: actions/upload-artifact@v2
|
2021-07-17 14:44:05 +00:00
|
|
|
with:
|
|
|
|
name: build-artifacts
|
|
|
|
path: dist
|
2021-07-17 14:58:03 +00:00
|
|
|
preview:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Deploy preview
|
|
|
|
needs: build
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-node@v2
|
|
|
|
id: node-setup
|
|
|
|
with:
|
|
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
|
|
- name: Build Artifacts
|
|
|
|
uses: actions/download-artifact@v2
|
|
|
|
with:
|
|
|
|
name: build-artifacts
|
|
|
|
path: dist
|
|
|
|
- name: Netlify CLI setup
|
|
|
|
run: npm install -g netlify-cli
|
|
|
|
- name: Deploy
|
2021-07-17 15:09:21 +00:00
|
|
|
id: preview-deploy
|
2021-07-17 14:58:03 +00:00
|
|
|
env:
|
|
|
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN }}
|
|
|
|
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
2021-07-17 15:09:21 +00:00
|
|
|
run: |
|
2021-07-17 15:15:11 +00:00
|
|
|
netlify deploy --dir=dist --json > output.log
|
2021-07-17 15:29:02 +00:00
|
|
|
export NETLIFY_STDOUT=$(cat output.log)
|
2021-07-17 15:09:21 +00:00
|
|
|
- name: Report
|
2021-07-17 15:29:02 +00:00
|
|
|
uses: actions/github-script@v2
|
|
|
|
with:
|
2021-07-17 15:40:32 +00:00
|
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
2021-07-17 15:29:02 +00:00
|
|
|
script: |
|
|
|
|
github.issues.createComment({
|
2021-07-17 15:52:26 +00:00
|
|
|
issue_number: context.paylod.pull_request.number,
|
2021-07-17 15:29:02 +00:00
|
|
|
owner: context.repo.owner,
|
|
|
|
repo: context.repo.repo,
|
2021-07-17 15:40:32 +00:00
|
|
|
body: process.env.NETLIFY_STDOUT
|
2021-07-17 15:29:02 +00:00
|
|
|
})
|