Skip to content

Commit aa10d8f

Browse files
committed
chore: improve workflow
1 parent 745dbd9 commit aa10d8f

File tree

3 files changed

+72
-18
lines changed

3 files changed

+72
-18
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,24 @@ jobs:
1717
node-version: [18]
1818

1919
steps:
20-
- uses: actions/checkout@v1
20+
- uses: actions/checkout@v4
2121

2222
- name: Use Node.js ${{ matrix.node-version }}
23-
uses: actions/setup-node@v1
23+
uses: actions/setup-node@v3
2424
with:
2525
node-version: ${{ matrix.node-version }}
2626

27-
- name: Cache node modules
28-
uses: actions/cache@v1
27+
- name: Get yarn cache directory path
28+
id: yarn-cache-dir-path
29+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
30+
31+
- uses: actions/cache@v3
32+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
2933
with:
30-
path: node_modules
31-
key: ${{ runner.OS }}-build-${{ hashFiles('**/yarn.lock') }}
34+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
35+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
3236
restore-keys: |
33-
${{ runner.OS }}-build-${{ env.cache-name }}-
34-
${{ runner.OS }}-build-
35-
${{ runner.OS }}-
37+
${{ runner.os }}-yarn-
3638
3739
- name: yarn install, build
3840
run: |
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Release built-in
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
release:
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
matrix:
13+
os: [ubuntu-latest]
14+
node-version: [18]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Use Node.js ${{ matrix.node-version }}
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: ${{ matrix.node-version }}
23+
24+
- name: Get yarn cache directory path
25+
id: yarn-cache-dir-path
26+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
27+
28+
- uses: actions/cache@v3
29+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
30+
with:
31+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
32+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
33+
restore-keys: |
34+
${{ runner.os }}-yarn-
35+
36+
- name: yarn install, build, bundle
37+
run: |
38+
yarn install
39+
CI=false yarn build:surge
40+
41+
- name: Upload Release Asset
42+
id: upload-release-asset
43+
uses: actions/upload-release-asset@v1
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
with:
47+
upload_url: ${{ github.event.release.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
48+
asset_path: ./yasd.tar.gz
49+
asset_name: built-in.tar.gz
50+
asset_content_type: application/tar+gzip

.github/workflows/release.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,24 @@ jobs:
1414
node-version: [18]
1515

1616
steps:
17-
- uses: actions/checkout@v1
17+
- uses: actions/checkout@v4
1818

1919
- name: Use Node.js ${{ matrix.node-version }}
20-
uses: actions/setup-node@v1
20+
uses: actions/setup-node@v3
2121
with:
2222
node-version: ${{ matrix.node-version }}
2323

24-
- name: Cache node modules
25-
uses: actions/cache@v1
24+
- name: Get yarn cache directory path
25+
id: yarn-cache-dir-path
26+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
27+
28+
- uses: actions/cache@v3
29+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
2630
with:
27-
path: node_modules
28-
key: ${{ runner.OS }}-build-${{ hashFiles('**/yarn.lock') }}
31+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
32+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
2933
restore-keys: |
30-
${{ runner.OS }}-build-${{ env.cache-name }}-
31-
${{ runner.OS }}-build-
32-
${{ runner.OS }}-
34+
${{ runner.os }}-yarn-
3335
3436
- name: yarn install, build, bundle
3537
run: |

0 commit comments

Comments
 (0)