Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 43 additions & 11 deletions .github/workflows/ci-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@ jobs:
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn --frozen-lockfile --non-interactive
- name: Install dependencies on a cache hit
if: steps.yarn-cache.outputs.cache-hit == 'true'
run: |
yarn --frozen-lockfile --non-interactive --offline
- name: Install dependencies on a cache miss
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: |
yarn --frozen-lockfile --non-interactive
- name: Check that code passes type checking
run: yarn type-check
- name: Check that ESLint config is consistent with Prettier
Expand All @@ -55,6 +61,15 @@ jobs:
with:
name: build
path: ./build
# This is used to checkout the same SHA in later jobs
- name: Persist build commit SHA
run: |
mkdir -p ./build-commit-sha && echo "${GITHUB_SHA}" > ./build-commit-sha/sha
- name: Upload buld commit SHA
uses: actions/upload-artifact@v1
with:
name: build-commit-sha
path: ./build-commit-sha

publish-github-pages:
name: Publish to GitHub Pages
Expand Down Expand Up @@ -114,9 +129,7 @@ jobs:
return(result.data.id);
- name: Publish to Netlify
id: publish-netlify
# FIXME: Once https://github.com/netlify/actions/pull/24 is merged, use
# the official one.
uses: Triloworld/actions/cli@3eff4d5cd9bf9f7ba528c1f1bbb94a37c3a3201d
uses: netlify/actions/cli@0b1104d9197d0ad6ac075a768fc7b76f86459a02
with:
args: deploy --dir=./build --message=\"Triggered by event ${{ github.event_name }} for ref ${{ github.ref }} and commit ${{ github.sha }}\"
env:
Expand All @@ -140,6 +153,7 @@ jobs:
environment_url: "${{ steps.publish-netlify.outputs.NETLIFY_URL }}",
// auto_inactive: true,
})
# FIXME: Remove this step when deployment links show up on the PR page.
- name: Post pull request comment with deployment link
if: success()
uses: actions/github-script@0.9.0
Expand Down Expand Up @@ -178,8 +192,22 @@ jobs:
run: echo "::set-output name=url::$(cat ./netlify-draft-url/url)"
# It is faster to install dependencies again than to download an artifact
# containing everything.
- name: Check the repository out
#
# Also there can be a race condition where the wrong SHA is checked out if
# something else has been merged into master before this checkout but
# after the previous checkout within this same GitHub Actions run. Avoid
# the race condition by specifying the SHA.
- name: Download build commit SHA
uses: actions/download-artifact@v1
with:
name: build-commit-sha
- name: Set build commit SHA to an output
id: build-commit-sha
run: echo "::set-output name=sha::$(cat ./build-commit-sha/sha)"
- name: Check the repository out at the same SHA as in build phase
uses: actions/checkout@v2
with:
ref: ${{ steps.build-commit-sha.outputs.sha }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
Expand All @@ -197,8 +225,14 @@ jobs:
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn --frozen-lockfile --non-interactive
- name: Install dependencies on a cache hit
if: steps.yarn-cache.outputs.cache-hit == 'true'
run: |
yarn --frozen-lockfile --non-interactive --offline
- name: Install dependencies on a cache miss
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: |
yarn --frozen-lockfile --non-interactive
- name: Install Playwright
uses: microsoft/playwright-github-action@11413a1e4dfa5b193634b90340f5fadf22b81b27
- name: Run E2E tests using Netlify
Expand Down Expand Up @@ -243,9 +277,7 @@ jobs:
return(result.data.id);
- name: Publish to Netlify
id: publish-netlify
# FIXME: Once https://github.com/netlify/actions/pull/24 is merged, use
# the official one.
uses: Triloworld/actions/cli@3eff4d5cd9bf9f7ba528c1f1bbb94a37c3a3201d
uses: netlify/actions/cli@0b1104d9197d0ad6ac075a768fc7b76f86459a02
with:
args: deploy --dir=./build --prod --message=\"Triggered by event ${{ github.event_name }} for ref ${{ github.ref }} and commit ${{ github.sha }}\"
env:
Expand Down