Skip to content

Commit 533b5a4

Browse files
committed
ci: reorganise workflows
1 parent b1c8e68 commit 533b5a4

File tree

3 files changed

+49
-21
lines changed

3 files changed

+49
-21
lines changed

.github/workflows/autofix.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: autofix.ci # needed to securely identify the workflow
22

33
on:
44
pull_request:
5-
push:
6-
branches: [ "main" ]
75

86
permissions:
97
contents: read
@@ -18,9 +16,15 @@ jobs:
1816
with:
1917
node-version: 20
2018
cache: "pnpm"
19+
2120
- run: pnpm install
22-
- name: Run sync
21+
22+
- name: Lint
23+
run: pnpm lint --fix
24+
25+
- name: Sync
2326
run: pnpm sync
2427
env:
2528
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
29+
2630
- uses: autofix-ci/action@ff86a557419858bb967097bfc916833f5647fa8c

.github/workflows/ci.yml

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,39 +21,28 @@ jobs:
2121
with:
2222
node-version: 20
2323
cache: "pnpm"
24+
2425
- run: pnpm install
2526

2627
- name: Lint
28+
# these run in the autofix workflow on pull requests
29+
if: github.event_name == 'push'
2730
run: pnpm lint
2831

2932
- name: Test types
3033
run: pnpm tsc --noEmit
3134

3235
- name: Sync
3336
run: pnpm sync
37+
# these run in the autofix workflow on pull requests
38+
if: github.event_name == 'push'
3439
env:
3540
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
3641

3742
- name: Sync Status
43+
# these run in the autofix workflow on pull requests
44+
if: github.event_name == 'push'
3845
run: git diff --exit-code
3946

4047
- name: Build
4148
run: pnpm build
42-
43-
- uses: dorny/paths-filter@v2
44-
if: github.event_name == 'push'
45-
id: changes
46-
with:
47-
filters: |
48-
modules:
49-
- 'modules/**'
50-
- 'lib/**'
51-
52-
- name: Publish to npm
53-
if: github.event_name == 'push' && steps.changes.outputs.modules == 'true'
54-
run: |
55-
echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" >> ~/.npmrc
56-
echo "//registry.pnpmpkg.com/:_authToken=$NPM_AUTH_TOKEN" >> ~/.npmrc
57-
pnpm release
58-
env:
59-
NPM_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}

.github/workflows/release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'modules/**'
9+
- 'lib/**'
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
ci:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- run: corepack enable
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: 20
23+
cache: "pnpm"
24+
- run: pnpm install
25+
26+
- name: Build
27+
run: pnpm build
28+
29+
- name: Publish to npm
30+
run: |
31+
echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" >> ~/.npmrc
32+
echo "//registry.pnpmpkg.com/:_authToken=$NPM_AUTH_TOKEN" >> ~/.npmrc
33+
pnpm release
34+
env:
35+
NPM_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}

0 commit comments

Comments
 (0)