Skip to content

Commit cb3a1c1

Browse files
authored
ci(workflow): add cache to workflows using actions/setup-node (#1107)
1 parent 2aae90e commit cb3a1c1

File tree

7 files changed

+36
-40
lines changed

7 files changed

+36
-40
lines changed

.github/workflows/CI.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,10 @@ jobs:
77

88
steps:
99
- uses: actions/checkout@v1
10-
- uses: actions/setup-node@v1
10+
- uses: actions/setup-node@v2
1111
with:
1212
node-version: "12.x"
13-
14-
- name: Get yarn cache directory path
15-
id: yarn-cache-dir-path
16-
run: echo "::set-output name=dir::$(yarn cache dir)"
17-
18-
- uses: actions/cache@v1
19-
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
20-
with:
21-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
22-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
23-
restore-keys: |
24-
${{ runner.os }}-yarn-
13+
cache: yarn
2514

2615
# Get projects set up
2716
- run: yarn install
@@ -38,9 +27,10 @@ jobs:
3827

3928
steps:
4029
- uses: actions/checkout@v1
41-
- uses: actions/setup-node@v1
30+
- uses: actions/setup-node@v2
4231
with:
4332
node-version: "12.x"
33+
cache: yarn
4434

4535
- name: Get yarn cache directory path
4636
id: yarn-cache-dir-path

.github/workflows/Deploy.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ jobs:
1414

1515
steps:
1616
- uses: actions/checkout@v2
17-
- uses: actions/setup-node@v1
17+
- uses: actions/setup-node@v2
1818
with:
1919
node-version: "12.x"
2020
registry-url: "https://registry.npmjs.org"
21+
cache: yarn
2122

2223
# Ensure everything is compiling
2324
- run: "yarn install"

.github/workflows/DeployExtensionsProd.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ jobs:
1111

1212
steps:
1313
- uses: actions/checkout@v2
14-
- uses: actions/setup-node@v1
14+
- uses: actions/setup-node@v2
1515
with:
1616
node-version: "12.x"
1717
registry-url: "https://registry.npmjs.org"
18+
cache: yarn
1819

1920
# Ensure everything is compiling
2021
- run: "yarn install"
@@ -28,18 +29,18 @@ jobs:
2829

2930
# To deploy we need isolated node_modules folders which yarn won't do because it is a workspace
3031
# So, remove the workspace
31-
- run: "rm package.json yarn.lock" # Re-run the yarn install outside of the workspace
32+
- run: "rm package.json yarn.lock" # Re-run the yarn install outside of the workspace
3233

3334
- run: |
34-
cd packages/svelte-vscode
35-
yarn install
35+
cd packages/svelte-vscode
36+
yarn install
3637
37-
# Just a hard constraint from the vscode marketplace's usage of azure tokens
38-
echo "Once a year this expires, tell Orta to access https://dev.azure.com/ortatherox0608/_usersSettings/tokens to get a new one"
38+
# Just a hard constraint from the vscode marketplace's usage of azure tokens
39+
echo "Once a year this expires, tell Orta to access https://dev.azure.com/ortatherox0608/_usersSettings/tokens to get a new one"
3940
40-
# Ship it
41-
npx vsce publish --yarn -p $VSCE_TOKEN
42-
npx ovsx publish --yarn -p $OVSX_TOKEN
41+
# Ship it
42+
npx vsce publish --yarn -p $VSCE_TOKEN
43+
npx ovsx publish --yarn -p $OVSX_TOKEN
4344
4445
env:
4546
VSCE_TOKEN: ${{ secrets.AZURE_PAN_TOKEN }}

.github/workflows/DeploySvelte2tsxProd.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ jobs:
1111

1212
steps:
1313
- uses: actions/checkout@v2
14-
- uses: actions/setup-node@v1
14+
- uses: actions/setup-node@v2
1515
with:
1616
node-version: "12.x"
1717
registry-url: "https://registry.npmjs.org"
18+
cache: yarn
1819

1920
# Ensure everything is compiling
2021
- run: "yarn install"
@@ -28,9 +29,9 @@ jobs:
2829

2930
# Ship it
3031
- run: |
31-
cd packages/svelte2tsx
32-
npm install
33-
npm publish
32+
cd packages/svelte2tsx
33+
npm install
34+
npm publish
3435
3536
env:
3637
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/DeploySvelteCheckProd.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ jobs:
1111

1212
steps:
1313
- uses: actions/checkout@v2
14-
- uses: actions/setup-node@v1
14+
- uses: actions/setup-node@v2
1515
with:
1616
node-version: "12.x"
1717
registry-url: "https://registry.npmjs.org"
18+
cache: yarn
1819

1920
# Ensure everything is compiling
2021
- run: "yarn install"
@@ -28,9 +29,9 @@ jobs:
2829

2930
# Ship it
3031
- run: |
31-
cd packages/svelte-check
32-
npm install
33-
npm publish
32+
cd packages/svelte-check
33+
npm install
34+
npm publish
3435
3536
env:
3637
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/DeploySvelteLanguageServerProd.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ jobs:
1111

1212
steps:
1313
- uses: actions/checkout@v2
14-
- uses: actions/setup-node@v1
14+
- uses: actions/setup-node@v2
1515
with:
1616
node-version: "12.x"
1717
registry-url: "https://registry.npmjs.org"
18+
cache: yarn
1819

1920
# Ensure everything is compiling
2021
- run: "yarn install"
@@ -28,9 +29,9 @@ jobs:
2829

2930
# Ship it
3031
- run: |
31-
cd packages/language-server
32-
npm install
33-
npm publish
32+
cd packages/language-server
33+
npm install
34+
npm publish
3435
3536
env:
3637
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/DeployTypescriptPluginProd.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ jobs:
1111

1212
steps:
1313
- uses: actions/checkout@v2
14-
- uses: actions/setup-node@v1
14+
- uses: actions/setup-node@v2
1515
with:
1616
node-version: "12.x"
1717
registry-url: "https://registry.npmjs.org"
18+
cache: yarn
1819

1920
# Ensure everything is compiling
2021
- run: "yarn install"
@@ -28,9 +29,9 @@ jobs:
2829

2930
# Ship it
3031
- run: |
31-
cd packages/typescript-plugin
32-
npm install
33-
npm publish
32+
cd packages/typescript-plugin
33+
npm install
34+
npm publish
3435
3536
env:
3637
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)