Skip to content

Commit 1bf0763

Browse files
authored
ci: step do install (#752)
* ci: step do install * ci: release the test does the setup * ci: exit early on cache hit
1 parent d53fd2a commit 1bf0763

10 files changed

Lines changed: 99 additions & 50 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-action.json
2+
3+
name: 'Restore pnpm cache'
4+
description: 'Sets up Node and pnpm, restores node_modules and ~/.cache/ from cache (no install)'
5+
inputs:
6+
node-version:
7+
description: 'Version of Node'
8+
required: false
9+
default: '24'
10+
runs:
11+
using: 'composite'
12+
steps:
13+
- uses: pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d #v6.0.5
14+
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e #v6.4.0
15+
with:
16+
node-version: ${{ inputs.node-version }}
17+
- uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae #v5.0.5
18+
with:
19+
path: |
20+
node_modules
21+
~/.cache/
22+
key: ${{ runner.os }}-node-${{ hashFiles('pnpm-lock.yaml') }}

.github/workflows/check-dist.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,17 @@ concurrency:
2727
cancel-in-progress: true
2828

2929
jobs:
30+
setup:
31+
uses: ./.github/workflows/setup.yml
3032
check-dist:
33+
needs: setup
3134
runs-on: ubuntu-latest
3235
timeout-minutes: 5
3336
steps:
3437
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
3538
with:
3639
persist-credentials: false
37-
- uses: andykenward/github-actions/setup-pnpm@4975fa85f6e689743962bbb5dbac847aaa843edb #v3.0.1
38-
with:
39-
node-version: 24
40-
- name: Cache
41-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae #v5.0.5
42-
with:
43-
path: |
44-
~/.cache/
45-
key: ${{ runner.os }}-node-${{ hashFiles('**/pnpm-lock.yaml', '**/.oxlintrc.json', '**/.oxfmtrc.json', '**/tsconfig.json', '**/knip.json', '**/vitest.config.ts', '**/vitest.setup.ts') }}
40+
- uses: ./.github/actions/setup-pnpm
4641
- name: Rebuild the dist/ directory
4742
run: pnpm run build
4843

.github/workflows/deploy-delete.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ on:
1212
concurrency:
1313
group: deploy-delete-${{ github.head_ref || github.run_id }}
1414

15+
permissions: {}
16+
1517
jobs:
1618
deploy-delete:
1719
permissions:

.github/workflows/deploy-main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ on:
88
concurrency:
99
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
1010

11+
permissions: {}
12+
1113
jobs:
1214
deploy-main:
1315
permissions:

.github/workflows/deploy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
concurrency:
1010
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
1111

12+
permissions: {}
13+
1214
jobs:
1315
deploy:
1416
if: ${{ !github.event.pull_request.head.repo.fork }}

.github/workflows/release.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ on:
1313

1414
concurrency: ${{ github.workflow }}-${{ github.ref }}
1515

16+
permissions: {}
17+
1618
jobs:
1719
release:
18-
name: Release
1920
if: ${{ github.repository == 'andykenward/github-actions-cloudflare-pages' && github.event.workflow_run.conclusion == 'success' }}
21+
name: Release
2022
runs-on: ubuntu-latest
2123
permissions:
2224
contents: write
@@ -28,15 +30,7 @@ jobs:
2830
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
2931
with:
3032
persist-credentials: false
31-
- uses: andykenward/github-actions/setup-pnpm@4975fa85f6e689743962bbb5dbac847aaa843edb #v3.0.1
32-
with:
33-
node-version: 24
34-
- name: Cache
35-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae #v5.0.5
36-
with:
37-
path: |
38-
~/.cache/
39-
key: ${{ runner.os }}-node-${{ hashFiles('**/pnpm-lock.yaml', '**/.oxlintrc.json', '**/.oxfmtrc.json', '**/tsconfig.json', '**/knip.json', '**/vitest.config.ts', '**/vitest.setup.ts') }}
33+
- uses: ./.github/actions/setup-pnpm
4034
- name: Create Release Pull Request
4135
id: changesets
4236
uses: changesets/action@6a0a831ff30acef54f2c6aa1cbbc1096b066edaf #v1.7.0

.github/workflows/setup.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2+
3+
name: setup
4+
5+
on:
6+
workflow_call:
7+
8+
jobs:
9+
setup:
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 5
12+
permissions:
13+
contents: read
14+
steps:
15+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
16+
with:
17+
persist-credentials: false
18+
- name: Cache
19+
id: cache
20+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae #v5.0.5
21+
with:
22+
path: |
23+
node_modules
24+
~/.cache/
25+
key: ${{ runner.os }}-node-${{ hashFiles('pnpm-lock.yaml') }}
26+
- if: steps.cache.outputs.cache-hit != 'true'
27+
uses: pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d #v6.0.5
28+
- if: steps.cache.outputs.cache-hit != 'true'
29+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e #v6.4.0
30+
with:
31+
node-version: 24
32+
cache: pnpm
33+
- name: Install dependencies
34+
if: steps.cache.outputs.cache-hit != 'true'
35+
run: pnpm install

.github/workflows/sync-readme-versions.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,21 @@ on:
88
- 'v*'
99
workflow_dispatch:
1010

11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
permissions: {}
16+
1117
jobs:
18+
setup:
19+
if: ${{ github.repository == 'andykenward/github-actions-cloudflare-pages' }}
20+
permissions:
21+
contents: read
22+
uses: ./.github/workflows/setup.yml
1223
sync:
24+
needs: setup
1325
name: Sync action version references
14-
if: ${{ github.repository == 'andykenward/github-actions-cloudflare-pages' }}
1526
runs-on: ubuntu-latest
1627
permissions:
1728
contents: write
@@ -21,9 +32,8 @@ jobs:
2132
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
2233
with:
2334
ref: main
24-
- uses: andykenward/github-actions/setup-pnpm@4975fa85f6e689743962bbb5dbac847aaa843edb #v3.0.1
25-
with:
26-
node-version: 24
35+
persist-credentials: false
36+
- uses: ./.github/actions/setup-pnpm
2737
- name: Sync action version references
2838
run: pnpm run sync:readme
2939
env:

.github/workflows/test.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,17 @@ concurrency:
1717
cancel-in-progress: true
1818

1919
jobs:
20+
setup:
21+
uses: ./.github/workflows/setup.yml
2022
test:
23+
needs: setup
2124
runs-on: ubuntu-latest
2225
timeout-minutes: 5
2326
steps:
2427
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
2528
with:
2629
persist-credentials: false
27-
- uses: andykenward/github-actions/setup-pnpm@4975fa85f6e689743962bbb5dbac847aaa843edb #v3.0.1
28-
with:
29-
node-version: 24
30-
- name: Cache
31-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae #v5.0.5
32-
with:
33-
path: |
34-
~/.cache/
35-
key: ${{ runner.os }}-node-${{ hashFiles('**/pnpm-lock.yaml', '**/.oxlintrc.json', '**/.oxfmtrc.json', '**/tsconfig.json', '**/knip.json', '**/vitest.config.ts', '**/vitest.setup.ts') }}
30+
- uses: ./.github/actions/setup-pnpm
3631
- name: Lint
3732
run: pnpm run lint --format=github
3833
- name: Typecheck

.github/workflows/update.yml

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,15 @@ on:
99
concurrency:
1010
group: ${{ github.workflow }}-${{ github.ref }}
1111

12+
permissions: {}
13+
1214
jobs:
15+
setup:
16+
permissions:
17+
contents: read
18+
uses: ./.github/workflows/setup.yml
1319
download:
20+
needs: setup
1421
permissions:
1522
contents: write
1623
pull-requests: write
@@ -20,15 +27,7 @@ jobs:
2027
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
2128
with:
2229
persist-credentials: false
23-
- uses: andykenward/github-actions/setup-pnpm@4975fa85f6e689743962bbb5dbac847aaa843edb #v3.0.1
24-
with:
25-
node-version: 24
26-
- name: Cache
27-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae #v5.0.5
28-
with:
29-
path: |
30-
~/.cache/
31-
key: ${{ runner.os }}-node-${{ hashFiles('**/pnpm-lock.yaml', '**/.oxlintrc.json', '**/.oxfmtrc.json', '**/tsconfig.json', '**/knip.json', '**/vitest.config.ts', '**/vitest.setup.ts') }}
30+
- uses: ./.github/actions/setup-pnpm
3231
- name: cli download payloads
3332
run: pnpm run download
3433
env:
@@ -46,6 +45,7 @@ jobs:
4645
body: |
4746
This is an automated PR to update payloads.
4847
types:
48+
needs: setup
4949
permissions:
5050
contents: write
5151
pull-requests: write
@@ -55,15 +55,7 @@ jobs:
5555
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
5656
with:
5757
persist-credentials: false
58-
- uses: andykenward/github-actions/setup-pnpm@4975fa85f6e689743962bbb5dbac847aaa843edb #v3.0.1
59-
with:
60-
node-version: 24
61-
- name: Cache
62-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae #v5.0.5
63-
with:
64-
path: |
65-
~/.cache/
66-
key: ${{ runner.os }}-node-${{ hashFiles('**/pnpm-lock.yaml', '**/.oxlintrc.json', '**/.oxfmtrc.json', '**/tsconfig.json', '**/knip.json', '**/vitest.config.ts', '**/vitest.setup.ts') }}
58+
- uses: ./.github/actions/setup-pnpm
6759
- name: cli all
6860
run: pnpm run tsc:types
6961
- name: Create Pull Request

0 commit comments

Comments
 (0)