From 87a7543be17f01a09c48901826b8aebc52e2d9a0 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sat, 17 Jul 2021 10:21:58 -0400 Subject: [PATCH 01/23] ci: stub --- .github/workflows/main.yml | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..e1b9475 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,40 @@ +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' + runs: yarn + 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 }} + - run: yarn build + -- 2.45.2 From 6bc0a03fe415141791a84f377836859944b3e0a8 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sat, 17 Jul 2021 10:23:22 -0400 Subject: [PATCH 02/23] fix: typo --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e1b9475..17ebff7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,7 +25,7 @@ jobs: key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }} - name: Install dependencies if: steps.cache-restore.outputs.cache-hit != 'true' - runs: yarn + run: yarn build: runs-on: ubuntu-latest name: Build -- 2.45.2 From 07c7ff67993242419de0af8be4277af4bb559028 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sat, 17 Jul 2021 10:26:49 -0400 Subject: [PATCH 03/23] fix: cache restore --- .github/workflows/main.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 17ebff7..dce07c1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,5 +36,11 @@ jobs: 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 }} - run: yarn build -- 2.45.2 From ae94195211c677ce967ea4e588353e5fd790220f Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sat, 17 Jul 2021 10:28:35 -0400 Subject: [PATCH 04/23] fix: install --- .github/workflows/main.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dce07c1..8c77def 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -42,5 +42,7 @@ jobs: path: | .yarn key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }} - - run: yarn build + - run: | + yarn + yarn build -- 2.45.2 From 2c4f4f68d41a9fb8523ce42f352dbeacfc033b20 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sat, 17 Jul 2021 10:30:16 -0400 Subject: [PATCH 05/23] fix: typo --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8c77def..904aa9f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -43,6 +43,6 @@ jobs: .yarn key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }} - run: | - yarn - yarn build + yarn + yarn build -- 2.45.2 From f537726d49c98f13ed10ca21c026bf71a15b2461 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sat, 17 Jul 2021 10:44:05 -0400 Subject: [PATCH 06/23] ci: caches, build, artifacts --- .github/workflows/main.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 904aa9f..51ee0d7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -36,13 +36,25 @@ jobs: id: node-setup with: node-version: ${{ env.NODE_VERSION }} - - uses: actions/cache@v2 + - name: Yarn cache + uses: actions/cache@v2 id: cache-restore with: path: | .yarn key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }} + - name: Parcel cache + uses: actions/cache@v2 + id: cache-restore + with: + path: | + .parcel-cache + key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }}-parcel - run: | yarn yarn build - + - name: Build Artifacts + uses: actions/upload-artifacts@v2 + with: + name: build-artifacts + path: dist -- 2.45.2 From 9bac74db48b5921e1f9f4f8b92d7f590c6aa2580 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sat, 17 Jul 2021 10:44:46 -0400 Subject: [PATCH 07/23] ci: caches, build, artifacts --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 51ee0d7..13916a2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,14 +38,14 @@ jobs: node-version: ${{ env.NODE_VERSION }} - name: Yarn cache uses: actions/cache@v2 - id: cache-restore + id: yarn-cache-restore with: path: | .yarn key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }} - name: Parcel cache uses: actions/cache@v2 - id: cache-restore + id: parcel-cache-restore with: path: | .parcel-cache -- 2.45.2 From 0d6d02c11e26cbfb4ee2ccbfeee2c32467a995be Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sat, 17 Jul 2021 10:46:10 -0400 Subject: [PATCH 08/23] fix: typo --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 13916a2..8434597 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -54,7 +54,7 @@ jobs: yarn yarn build - name: Build Artifacts - uses: actions/upload-artifacts@v2 + uses: actions/upload-artifact@v2 with: name: build-artifacts path: dist -- 2.45.2 From afc8c9d0b4c2cf351f407e24e3198b8a9595fb0d Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sat, 17 Jul 2021 10:58:03 -0400 Subject: [PATCH 09/23] ci: preview deploy --- .github/workflows/main.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8434597..262e39c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -58,3 +58,25 @@ jobs: with: name: build-artifacts path: dist + 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 + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} + run: netlify deploy --dir=dist -- 2.45.2 From 05ef0435a453fa026e67a592cfab82dc5b10dbb0 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sat, 17 Jul 2021 11:09:21 -0400 Subject: [PATCH 10/23] ci: preview deploy output --- .github/workflows/main.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 262e39c..48678b4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -76,7 +76,13 @@ jobs: - name: Netlify CLI setup run: npm install -g netlify-cli - name: Deploy + id: preview-deploy env: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN }} NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} - run: netlify deploy --dir=dist + run: | + netlify deploy --dir=dist > output.log + echo "::set-output name=stdout::$(cat output.log)" + - name: Report + run: | + echo ${{ steps.preview-deploy.outputs.stdout }} -- 2.45.2 From 8836a867b42863c53f5d0fe552719b988e3f9266 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sat, 17 Jul 2021 11:15:11 -0400 Subject: [PATCH 11/23] ci: preview deploy output --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 48678b4..18cfee4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -81,7 +81,7 @@ jobs: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN }} NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} run: | - netlify deploy --dir=dist > output.log + netlify deploy --dir=dist --json > output.log echo "::set-output name=stdout::$(cat output.log)" - name: Report run: | -- 2.45.2 From 8e52876eb867a71ac87d24b38a62793cde1f452d Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sat, 17 Jul 2021 11:29:02 -0400 Subject: [PATCH 12/23] ci: preview deploy output --- .github/workflows/main.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 18cfee4..b2e6992 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -82,7 +82,15 @@ jobs: NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} run: | netlify deploy --dir=dist --json > output.log - echo "::set-output name=stdout::$(cat output.log)" + export NETLIFY_STDOUT=$(cat output.log) - name: Report - run: | - echo ${{ steps.preview-deploy.outputs.stdout }} + uses: actions/github-script@v2 + with: + github-token: ${{ secrets.GITHUB_TOKEN }}i + script: | + github.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: ${{ $NETLIFY_STDOUT }} + }) -- 2.45.2 From 060eb07cd48f88f1dbf9172f261ecef044ce88db Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sat, 17 Jul 2021 11:30:28 -0400 Subject: [PATCH 13/23] ci: preview deploy output --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b2e6992..dd40c05 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -92,5 +92,5 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: ${{ $NETLIFY_STDOUT }} + body: ${{ env.NETLIFY_STDOUT }} }) -- 2.45.2 From 29f00ea74befaf54a768b269f9efbd82cb21f0f1 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sat, 17 Jul 2021 11:40:32 -0400 Subject: [PATCH 14/23] ci: preview deploy output --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dd40c05..f7b4141 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -86,11 +86,11 @@ jobs: - name: Report uses: actions/github-script@v2 with: - github-token: ${{ secrets.GITHUB_TOKEN }}i + github-token: ${{ secrets.GITHUB_TOKEN }} script: | github.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: ${{ env.NETLIFY_STDOUT }} + body: process.env.NETLIFY_STDOUT }) -- 2.45.2 From 66a4cb88553858b5c282e8770c27fac3c2936a1e Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sat, 17 Jul 2021 11:45:58 -0400 Subject: [PATCH 15/23] ci: preview deploy output --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f7b4141..b8dca03 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -89,7 +89,7 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} script: | github.issues.createComment({ - issue_number: context.issue.number, + issue_number: event.pull_request.number, owner: context.repo.owner, repo: context.repo.repo, body: process.env.NETLIFY_STDOUT -- 2.45.2 From 66ed254127f82be27b04e7d7d87e22bbcbf9557e Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sat, 17 Jul 2021 11:49:25 -0400 Subject: [PATCH 16/23] ci: preview deploy output --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b8dca03..caa7a48 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -89,7 +89,7 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} script: | github.issues.createComment({ - issue_number: event.pull_request.number, + issue_number: github.event.pull_request.number, owner: context.repo.owner, repo: context.repo.repo, body: process.env.NETLIFY_STDOUT -- 2.45.2 From 488190334b76081f837dea6159e68487abad2969 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sat, 17 Jul 2021 11:52:26 -0400 Subject: [PATCH 17/23] ci: preview deploy output --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index caa7a48..daa6b15 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -89,7 +89,7 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} script: | github.issues.createComment({ - issue_number: github.event.pull_request.number, + issue_number: context.paylod.pull_request.number, owner: context.repo.owner, repo: context.repo.repo, body: process.env.NETLIFY_STDOUT -- 2.45.2 From 0cf4b22d9057da3dcc2930afb29c5d8b8d1c86e4 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sat, 17 Jul 2021 11:56:18 -0400 Subject: [PATCH 18/23] ci: preview deploy output --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index daa6b15..62f377a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,7 +1,7 @@ on: push: - #branches: - # master + branches: + master pull_request: env: @@ -89,7 +89,7 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} script: | github.issues.createComment({ - issue_number: context.paylod.pull_request.number, + issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: process.env.NETLIFY_STDOUT -- 2.45.2 From dee7e4066fe50e0e38b2d7c9a5c097772a0c3688 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sat, 17 Jul 2021 12:08:43 -0400 Subject: [PATCH 19/23] ci: preview deploy output --- .github/workflows/main.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 62f377a..401b4a9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -82,9 +82,11 @@ jobs: NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} run: | netlify deploy --dir=dist --json > output.log - export NETLIFY_STDOUT=$(cat output.log) + echo "::set-output name=draft-url::$(grep 'Website Draft URL' output.log)" - name: Report uses: actions/github-script@v2 + env: + DRAFT_URL: steps.preview-deploy.outputs.draft-url with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | @@ -92,5 +94,5 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: process.env.NETLIFY_STDOUT + body: `Branch deployed at {process.env.DRAFT_URL}` }) -- 2.45.2 From e682d220a9be0d2881c8204fa828e5ec371bbc58 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sat, 17 Jul 2021 12:12:07 -0400 Subject: [PATCH 20/23] ci: preview deploy output --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 401b4a9..ed182ec 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -94,5 +94,5 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: `Branch deployed at {process.env.DRAFT_URL}` + body: `:eyes: Branch deployed at ${process.env.DRAFT_URL}` }) -- 2.45.2 From 16c0ec504a9b0e7011381e86346f44d6bfe6ab1f Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sat, 17 Jul 2021 12:15:10 -0400 Subject: [PATCH 21/23] ci: preview deploy output --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ed182ec..fce5658 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -86,7 +86,7 @@ jobs: - name: Report uses: actions/github-script@v2 env: - DRAFT_URL: steps.preview-deploy.outputs.draft-url + DRAFT_URL: ${{ steps.preview-deploy.outputs.draft-url }} with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | -- 2.45.2 From 35149e6cd427c246408eec0465df82d0c07daec1 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sat, 17 Jul 2021 12:20:44 -0400 Subject: [PATCH 22/23] ci: preview deploy output --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fce5658..3dfd290 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -81,7 +81,7 @@ jobs: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN }} NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} run: | - netlify deploy --dir=dist --json > output.log + netlify deploy --dir=dist > output.log echo "::set-output name=draft-url::$(grep 'Website Draft URL' output.log)" - name: Report uses: actions/github-script@v2 -- 2.45.2 From 0dbfb75ff793ee075fa4387f8ec93bc7e5c7e612 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sat, 17 Jul 2021 12:28:19 -0400 Subject: [PATCH 23/23] fix: conds --- .github/workflows/main.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3dfd290..3493399 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -61,6 +61,7 @@ jobs: preview: runs-on: ubuntu-latest name: Deploy preview + if: ${{ github.ref != 'refs/head/master' }} needs: build steps: - uses: actions/checkout@v2 @@ -96,3 +97,28 @@ jobs: repo: context.repo.repo, body: `:eyes: Branch deployed at ${process.env.DRAFT_URL}` }) + deploy: + runs-on: ubuntu-latest + name: Deploy + needs: build + if: ${{ github.ref == 'refs/head/master' }} + 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 + id: preview-deploy + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} + run: | + netlify deploy --dir=dist --prod -- 2.45.2