Skip to content

Commit cbd6080

Browse files
committed
Sync ci and publish workflows
1 parent b573319 commit cbd6080

3 files changed

Lines changed: 63 additions & 37 deletions

File tree

.github/workflows/ci.yml

Lines changed: 51 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ on:
77
merge_group:
88
branches:
99
- main
10+
- next
11+
- "maintenance/v[0-9]+"
1012

1113
permissions:
1214
contents: read
@@ -16,39 +18,24 @@ concurrency:
1618
cancel-in-progress: true
1719

1820
jobs:
19-
build:
20-
name: Build
21+
lint-workflows:
22+
name: Lint workflows
2123
runs-on: ubuntu-latest
24+
permissions:
25+
actions: read # only required in private repos
26+
security-events: write # allow writing security events
2227
steps:
2328
- name: Check out repo
2429
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2530
with:
2631
persist-credentials: false
2732

28-
- uses: ./.github/actions/ci-setup
29-
30-
- name: Build
31-
run: pnpm build
32-
33-
lint:
34-
name: Lint
35-
runs-on: ubuntu-latest
36-
steps:
37-
- name: Check out repo
38-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
33+
- name: Run zizmor
34+
uses: zizmorcore/zizmor-action@5f14fd08f7cf1cb1609c1e344975f152c7ee938d # v0.5.6
3935
with:
40-
persist-credentials: false
41-
42-
- uses: ./.github/actions/ci-setup
43-
44-
- name: Codegen
45-
run: pnpm codegen:github
46-
47-
- name: Lint
48-
run: pnpm lint
49-
50-
- name: Format
51-
run: pnpm format
36+
persona: pedantic
37+
annotations: true
38+
advanced-security: false
5239

5340
test:
5441
name: Test
@@ -81,12 +68,49 @@ jobs:
8168
env:
8269
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8370

71+
typecheck:
72+
name: Typecheck
73+
runs-on: ubuntu-latest
74+
timeout-minutes: 20
75+
steps:
76+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
77+
with:
78+
persist-credentials: false
79+
80+
- uses: ./.github/actions/ci-setup
81+
82+
- name: Codegen
83+
run: pnpm codegen:github
84+
85+
- name: Typecheck
86+
run: pnpm typecheck
87+
88+
lint:
89+
name: Lint
90+
runs-on: ubuntu-latest
91+
timeout-minutes: 20
92+
steps:
93+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
94+
with:
95+
persist-credentials: false
96+
97+
- uses: ./.github/actions/ci-setup
98+
99+
- name: Codegen
100+
run: pnpm codegen:github
101+
102+
- name: Lint
103+
run: pnpm lint
104+
105+
- name: Format
106+
run: pnpm format
107+
84108
ci-ok:
85109
name: CI OK
86110
runs-on: ubuntu-latest
87111
if: always()
88-
needs: [build, lint, test]
112+
needs: [lint-workflows, test, typecheck, lint]
89113
steps:
90114
- name: Exit with error if some jobs are not successful
91-
if: ${{ always() && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) }}
92115
run: exit 1
116+
if: ${{ always() && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) }}

.github/workflows/publish.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ on:
44
push:
55
branches:
66
- main
7+
- next
8+
- 'maintenance/v[0-9]+'
79

810
concurrency:
911
group: ${{ github.workflow }}-${{ github.ref }}
1012
cancel-in-progress: false
1113
queue: max
1214

13-
permissions: {}
15+
permissions: {} # each job should define its own permission explicitly
1416

1517
jobs:
1618
version:
@@ -21,8 +23,7 @@ jobs:
2123
outputs:
2224
hasChangesets: ${{ steps.changesets.outputs.hasChangesets }}
2325
permissions:
24-
contents: write # to create version commits (changesets/action)
25-
pull-requests: write # to create pull request (changesets/action)
26+
contents: read # to check out repo (actions/checkout)
2627
steps:
2728
- name: Check out repo
2829
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -33,11 +34,13 @@ jobs:
3334
with:
3435
skip-cache: true # avoid cache poisoning attacks
3536

36-
- uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
37+
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
3738
id: app-token
3839
with:
3940
client-id: ${{ vars.APP_CLIENT_ID }}
4041
private-key: ${{ secrets.APP_PRIVATE_KEY }}
42+
permission-contents: write # to create version commits (changesets/action)
43+
permission-pull-requests: write # to create pull request (changesets/action)
4144

4245
- name: Create or update release pull request
4346
id: changesets
@@ -66,11 +69,8 @@ jobs:
6669
with:
6770
skip-cache: true # avoid cache poisoning attacks
6871

69-
- name: Build
70-
run: pnpm build
71-
7272
- name: Publish to npm
7373
uses: changesets/action@63a615b9cd06ba9a3e6d13796c7fbcb080a60a0b # v1.8.0
7474
with:
75-
publish: pnpm changeset publish
75+
publish: pnpm release
7676
commitMode: github-api

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,15 @@
4848
"access": "public"
4949
},
5050
"scripts": {
51-
"build": "pnpm codegen:github && tsc && tsdown",
51+
"build": "pnpm codegen:github && tsdown",
5252
"codegen:github": "graphql-codegen --config src/github/codegen.ts",
53+
"typecheck": "tsc",
5354
"format": "oxfmt --check",
5455
"format:fix": "oxfmt",
5556
"lint": "oxlint",
5657
"test:integration": "vitest -c vitest.integration.config.ts",
57-
"version-packages": "pnpm changeset version && pnpm format:fix"
58+
"version-packages": "changeset version && pnpm format:fix",
59+
"release": "pnpm build && changeset publish"
5860
},
5961
"dependencies": {
6062
"isomorphic-git": "^1.36.3"

0 commit comments

Comments
 (0)