Skip to content

Commit 3d7005a

Browse files
authored
chore: update workflow files (#1271)
1 parent e4b826c commit 3d7005a

File tree

3 files changed

+86
-26
lines changed

3 files changed

+86
-26
lines changed

.github/workflows/cache.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Cache
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: '0 4 * * *'
6+
7+
jobs:
8+
refresh:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- if: >
12+
github.event_name == 'schedule'
13+
name: 🧹🪣 Delete caches
14+
run: gh cache delete --all
15+
env:
16+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
GH_REPO: ${{ github.repository }}
18+
19+
- name: ⬇️ Checkout package.json
20+
uses: actions/checkout@v4
21+
with:
22+
sparse-checkout-cone-mode: false
23+
sparse-checkout: |
24+
package.json
25+
- id: install
26+
name: 📥 Install deps
27+
run: yarn
28+
env:
29+
HUSKY_SKIP_INSTALL: true
30+
- if: >
31+
steps.install.outcome == 'success'
32+
name: ♻️ Save node_modules
33+
uses: actions/cache/save@v4
34+
with:
35+
path: |
36+
yarn.lock
37+
node_modules
38+
key: ${{ hashFiles('package.json') }}-${{ hashFiles('yarn.lock') }}

.github/workflows/ci.yml

Lines changed: 47 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,45 @@
11
name: CI
22
on:
33
push:
4-
branches:
5-
[
6-
'+([0-9])?(.{+([0-9]),x}).x',
7-
'main',
8-
'next',
9-
'next-major',
10-
'beta',
11-
'alpha',
12-
'!all-contributors/**',
13-
]
4+
branches-ignore: ['all-contributors/**']
145
pull_request:
156
branches-ignore: ['all-contributors/**']
7+
168
jobs:
179
validate:
1810
runs-on: ubuntu-latest
11+
if: >
12+
github.event_name != 'pull_request' ||
13+
github.event.pull_request.head.repo.fork
1914
steps:
2015
- name: ⬇️ Checkout repo
21-
uses: actions/checkout@v2
22-
- name: 📥 Download deps
23-
uses: bahmutov/npm-install@v1
16+
uses: actions/checkout@v4
17+
- id: restore
18+
name: ♻️ Restore node_modules
19+
uses: actions/cache/restore@v4
2420
with:
25-
useLockFile: false
26-
install-command: yarn --silent
21+
path: |
22+
yarn.lock
23+
node_modules
24+
key: ${{ hashFiles('package.json') }}
25+
restore-keys: ${{ hashFiles('package.json') }}-
26+
27+
- id: install
28+
if: >
29+
steps.restore.outputs.cache-matched-key == ''
30+
name: 📥 Install deps
31+
run: yarn
2732
env:
2833
HUSKY_SKIP_INSTALL: true
34+
- if: >
35+
steps.install.outcome == 'success'
36+
name: ♻️ Save node_modules
37+
uses: actions/cache/save@v4
38+
with:
39+
path: |
40+
yarn.lock
41+
node_modules
42+
key: ${{ hashFiles('package.json') }}-${{ hashFiles('yarn.lock') }}
2943
3044
- name: ✍ Lint
3145
run: npm run lint
@@ -38,24 +52,30 @@ jobs:
3852
- name: 🏗 Build
3953
run: npm run build
4054

41-
- name: ⬆️ Upload coverage report
42-
uses: codecov/codecov-action@v1
55+
- name: ☂️ Upload coverage report
56+
uses: codecov/codecov-action@v5
57+
env:
58+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4359

4460
release:
4561
needs: validate
4662
runs-on: ubuntu-latest
47-
if:
48-
${{ github.repository == 'testing-library/user-event' &&
63+
if: >
64+
github.event_name == 'push' &&
65+
github.repository == 'testing-library/user-event' &&
4966
contains('refs/heads/main,refs/heads/beta,refs/heads/alpha', github.ref)
50-
&& github.event_name == 'push' }}
5167
steps:
5268
- name: ⬇️ Checkout repo
53-
uses: actions/checkout@v2
54-
- name: 📥 Download deps
55-
uses: bahmutov/npm-install@v1
69+
uses: actions/checkout@v4
70+
- name: ♻️ Restore node_modules
71+
uses: actions/cache/restore@v4
5672
with:
57-
useLockFile: false
58-
install-command: yarn --silent
73+
path: |
74+
yarn.lock
75+
node_modules
76+
key: ${{ runner.os }}-${{ hashFiles('package.json') }}
77+
- name: 📥 Install deps
78+
run: yarn
5979
env:
6080
HUSKY_SKIP_INSTALL: true
6181

@@ -64,6 +84,8 @@ jobs:
6484

6585
- name: 🚀 Release
6686
uses: ph-fritsche/action-release@v2
87+
with:
88+
dry: ${{ vars.RELEASE_DRY }}
6789
env:
6890
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6991
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

lint-staged.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
2-
'*.+(json|yml|yaml|css|less|scss|md|gql|graphql|mdx|vue)': [
2+
'*.+(json|css|less|scss|md|gql|graphql|mdx|vue)': [
33
`kcd-scripts format`,
44
],
55
'*.+(js|jsx|mjs|cjs|ts|tsx|mts|cts)': [

0 commit comments

Comments
 (0)