Skip to content

Commit 868dc16

Browse files
committed
Use environment variables
1 parent 5088cd4 commit 868dc16

File tree

2 files changed

+18
-21
lines changed

2 files changed

+18
-21
lines changed

.github/workflows/checks.yml

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
# This workflow performs basic checks:
2-
#
3-
# 1. run a preparation step to install and cache node modules
4-
# 2. once prep succeeds, lint and test run in parallel
5-
#
6-
# The checks only run on non-draft Pull Requests. They don't run on the main
7-
# branch prior to deploy. It's recommended to use branch protection to avoid
8-
# pushes straight to 'main'.
9-
101
name: Checks
112

123
on:
@@ -19,6 +10,7 @@ on:
1910

2011
env:
2112
NODE: 18
13+
WORKING_DIRECTORY: web-vite
2214

2315
jobs:
2416
prep:
@@ -42,19 +34,19 @@ jobs:
4234
- name: Get yarn cache directory path
4335
id: yarn-cache-dir-path
4436
run: echo "::set-output name=dir::$(yarn cache dir)"
45-
working-directory: web-vite
37+
working-directory: ${{ env.WORKING_DIRECTORY }}
4638

4739
- uses: actions/cache@v3
4840
id: yarn-cache
4941
with:
5042
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
51-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
43+
key: ${{ runner.os }}-yarn-${{ hashFiles('${{ env.WORKING_DIRECTORY }}/yarn.lock') }}
5244
restore-keys: |
5345
${{ runner.os }}-yarn-
5446
5547
- name: Install
5648
run: yarn install
57-
working-directory: web-vite
49+
working-directory: ${{ env.WORKING_DIRECTORY }}
5850

5951
lint:
6052
needs: prep
@@ -72,19 +64,20 @@ jobs:
7264
- name: Get yarn cache directory path
7365
id: yarn-cache-dir-path
7466
run: echo "::set-output name=dir::$(yarn cache dir)"
67+
working-directory: ${{ env.WORKING_DIRECTORY }}
7568

7669
- uses: actions/cache@v3
7770
id: yarn-cache
7871
with:
7972
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
80-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
73+
key: ${{ runner.os }}-yarn-${{ hashFiles('${{ env.WORKING_DIRECTORY }}/yarn.lock') }}
8174
restore-keys: |
8275
${{ runner.os }}-yarn-
8376
8477
- name: Install
8578
run: yarn install
86-
working-directory: web-vite
79+
working-directory: ${{ env.WORKING_DIRECTORY }}
8780

8881
- name: Lint
8982
run: yarn lint
90-
working-directory: web-vite
83+
working-directory: ${{ env.WORKING_DIRECTORY }}

.github/workflows/deploy-web.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
branches:
66
- main
77

8+
env:
9+
NODE: 18
10+
WORKING_DIRECTORY: web-vite
11+
812
jobs:
913
build:
1014
runs-on: ubuntu-latest
@@ -18,23 +22,23 @@ jobs:
1822
- name: Checkout
1923
uses: actions/checkout@v3
2024

21-
- name: Use Node.js 18
25+
- name: Use Node.js ${{ env.NODE }}
2226
uses: actions/setup-node@v3
2327
with:
24-
node-version: 18
28+
node-version: ${{ env.NODE }}
2529
cache: "yarn"
26-
cache-dependency-path: web-vite/yarn.lock
30+
cache-dependency-path: ${{ env.WORKING_DIRECTORY }}/yarn.lock
2731

2832
- name: Install Dependencies
2933
run: yarn install
30-
working-directory: web-vite
34+
working-directory: ${{ env.WORKING_DIRECTORY }}
3135

3236
- name: Lint
3337
run: yarn lint
34-
working-directory: web-vite
38+
working-directory: ${{ env.WORKING_DIRECTORY }}
3539

3640
- name: Deploy to surge
3741
run: yarn deploy
38-
working-directory: web-vite
42+
working-directory: ${{ env.WORKING_DIRECTORY }}
3943
env:
4044
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}

0 commit comments

Comments
 (0)