forked from hakkafinance/hakka.finance
-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (60 loc) · 1.95 KB
/
prod.yml
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
# Name of workflow
name: Production workflow
# When workflow is triggered
on:
push:
branches:
- main
- master
# Jobs to carry out
jobs:
deploy:
# Operating system to run job on
runs-on: ubuntu-latest
# Steps in job
steps:
# Get code from repo
- name: Checkout code
uses: actions/checkout@v3
# Check project version
- name: Extract version
id: extract_version
uses: Saionaro/extract-package-version@v1.1.1
- name: Print version
run: echo ${{ steps.extract_version.outputs.version }}
- name: Cache version
id: cache-version
uses: actions/cache@v3
with:
path: package.json
key: ${{ runner.os }}-${{ steps.extract_version.outputs.version }}
- name: Check version exists
if: steps.cache-version.outputs.cache-hit == 'true'
run: exit 1
# Install NodeJS
- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v3
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 npm install and build on our code
- run: yarn
- run: yarn build
# Deploy to Netlify using our production secrets
- name: Deploy to netlify
uses: netlify/actions/cli@master
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID_PROD }}
with:
args: deploy --dir=public --prod
secrets: '["NETLIFY_AUTH_TOKEN", "NETLIFY_SITE_ID_PROD"]'