-
Notifications
You must be signed in to change notification settings - Fork 1
74 lines (64 loc) · 2.28 KB
/
main.yml
File metadata and controls
74 lines (64 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: CI
# This action works with pull requests and pushes
on:
pull_request:
push:
branches:
- production
- develop
repository_dispatch:
types: [airtable]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Setup Node.js environment
uses: actions/setup-node@v3.5.1
- name: Checkout Repo
uses: actions/checkout@v2.3.0
with:
# Make sure the actual branch is checked out when running on pull requests
ref: ${{ github.head_ref }}
- name: Extract Branch Name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract-branch
- name: Extract Commit Name
shell: bash
run: echo "##[set-output name=commit;]$(git log -1 --pretty=%B)"
id: extract-commit
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-build-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-npm-
- name: Install Dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm install
- name: Build Site
run: npm run build
env:
AIRTABLE_KEY: ${{ secrets.AIRTABLE_KEY }}
BASE_ID: ${{ secrets.BASE_ID }}
LOCATIONIQ: ${{ secrets.LOCATIONIQ }}
- name: Deploy to Netlify
id: netlify-deploy
uses: nwtgck/actions-netlify@v1.1.5
with:
# Publish directory
publish-dir: "./public"
production-branch: production
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: Deploy from ${{ steps.extract-branch.outputs.branch }} | ${{ steps.extract-commit.outputs.commit }} | ${{ github.sha }}
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
- name: Run Lighthouse Tests
run: |
npm install -g @lhci/cli@0.4.x
lhci autorun --upload.target=temporary-public-storage --collect.url=${{ steps.netlify-deploy.outputs.deploy-url }} || echo "LHCI failed!"
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}