Skip to content

Commit 5082da4

Browse files
authored
Merge branch 'main' into charlie/initial-monorepo-setup
2 parents 0798a46 + f785d22 commit 5082da4

File tree

2 files changed

+77
-35
lines changed

2 files changed

+77
-35
lines changed

.github/workflows/release.yml

Lines changed: 74 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,131 @@
1-
name: Test and Release
1+
name: CI — test → gate → release
22

33
on:
44
push:
55
branches:
6-
- main
7-
- "release/**"
8-
- "prerelease/**"
6+
- "**"
7+
tags:
8+
- "**"
9+
pull_request:
10+
types: [opened, synchronize, reopened, ready_for_review]
911

10-
concurrency: ${{ github.workflow }}-${{ github.ref }}
12+
# Ensure only one workflow per ref is active at a time
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
# Default, least-privilege token permissions; jobs elevate as needed
18+
permissions:
19+
contents: read
1120

1221
jobs:
1322
test:
14-
name: Test (Node ${{ matrix.node }})
23+
name: Test (Node ${{ matrix.node-version }})
1524
runs-on: ubuntu-latest
1625
strategy:
1726
fail-fast: false
1827
matrix:
19-
node: [22.x, 24.x]
28+
node-version: [22.x, 24.x]
2029
steps:
21-
- uses: actions/checkout@v4
30+
- name: Checkout Repo
31+
uses: actions/checkout@v4
2232
with:
2333
fetch-depth: 0
24-
- uses: actions/setup-node@v4
34+
- name: Install pnpm
35+
uses: pnpm/action-setup@v4
36+
with:
37+
package_json_file: package.json
38+
run_install: false
39+
- name: Setup Node.js ${{ matrix.node-version }}
40+
uses: actions/setup-node@v4
2541
with:
26-
node-version: ${{ matrix.node }}
42+
node-version: ${{ matrix.node-version }}
2743
cache: pnpm
2844
cache-dependency-path: pnpm-lock.yaml
29-
- uses: pnpm/action-setup@v4
30-
with:
31-
# Use the pnpm version pinned in package.json `packageManager` to avoid conflicts
32-
run_install: false
33-
- run: pnpm install --frozen-lockfile
34-
- run: pnpm -w run fmt:check
35-
- run: pnpm -w run typecheck:tsgo
45+
- name: Install dependencies
46+
run: pnpm install --frozen-lockfile
47+
- name: Format check
48+
run: pnpm -w run fmt:check
49+
- name: Typecheck (tsgo)
50+
run: pnpm -w run typecheck:tsgo
3651

3752
determine_release:
53+
name: Determine release
54+
needs: [test]
3855
runs-on: ubuntu-latest
3956
outputs:
4057
is_prerelease: ${{ steps.determine.outputs.is_prerelease }}
4158
is_release: ${{ steps.determine.outputs.is_release }}
4259
steps:
43-
- uses: actions/checkout@v4
60+
- name: Checkout Repo
61+
uses: actions/checkout@v4
4462
with:
4563
fetch-depth: 0
46-
- uses: actions/setup-node@v4
64+
- name: Install pnpm
65+
uses: pnpm/action-setup@v4
66+
with:
67+
package_json_file: package.json
68+
run_install: false
69+
- name: Setup Node.js 24
70+
uses: actions/setup-node@v4
4771
with:
4872
node-version: 24.x
4973
cache: pnpm
5074
cache-dependency-path: pnpm-lock.yaml
51-
- uses: pnpm/action-setup@v4
52-
with:
53-
run_install: false
54-
- run: pnpm install --frozen-lockfile
55-
- id: determine
75+
- name: Install dependencies
76+
run: pnpm install --frozen-lockfile
77+
- name: Compute release flags
78+
id: determine
5679
run: |
57-
pnpm changeset status --output=changeset-status.json
80+
# Changesets can error on PR merge refs; tolerate and default to no pre mode
81+
pnpm changeset status --output=changeset-status.json || echo '{}' > changeset-status.json
5882
PRE=$(jq -r '.preState.mode // ""' changeset-status.json)
5983
rm -f changeset-status.json
6084
echo "is_prerelease=$([[ $PRE = 'pre' ]] && echo true || echo false)" >> $GITHUB_OUTPUT
6185
echo "is_release=$([[ $GITHUB_REF_NAME = 'main' ]] && echo true || echo false)" >> $GITHUB_OUTPUT
6286
6387
release:
88+
name: Release
6489
needs: [test, determine_release]
65-
if: needs.determine_release.outputs.is_release == 'true' || needs.determine_release.outputs.is_prerelease == 'true'
90+
if: ${{ github.event_name == 'push' && (needs.determine_release.outputs.is_release == 'true' || needs.determine_release.outputs.is_prerelease == 'true') }}
6691
permissions:
6792
contents: write
6893
runs-on: ubuntu-latest
6994
steps:
70-
- uses: actions/checkout@v4
95+
- name: Checkout Repo
96+
uses: actions/checkout@v4
7197
with:
7298
fetch-depth: 0
73-
- run: git config user.name "GitHubActions" && git config user.email "[email protected]"
74-
- uses: actions/setup-node@v4
99+
- name: Configure Git author (for tag/commit)
100+
run: |
101+
git config user.name "GitHubActions"
102+
git config user.email "[email protected]"
103+
- name: Install pnpm
104+
uses: pnpm/action-setup@v4
105+
with:
106+
package_json_file: package.json
107+
run_install: false
108+
- name: Setup Node.js 24 (with npm registry)
109+
uses: actions/setup-node@v4
75110
with:
76111
node-version: 24.x
77112
cache: pnpm
78113
cache-dependency-path: pnpm-lock.yaml
79114
registry-url: https://registry.npmjs.org
80-
- uses: pnpm/action-setup@v4
81-
with:
82-
run_install: false
83-
- run: pnpm install --frozen-lockfile
84-
- run: pnpm build
115+
always-auth: true
116+
env:
117+
# Ensure the registry is authenticated for publish
118+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
119+
- name: Install dependencies
120+
run: pnpm install --frozen-lockfile
121+
- name: Build
122+
run: pnpm build
85123
- name: Publish with Changesets
86124
env:
125+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87126
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
88127
run: |
89128
pnpm changeset status
90129
pnpm changeset version
91130
pnpm changeset publish
92-
git push --follow-tags --no-verify || true
131+
git push --follow-tags --no-verify

packages/eslint-config/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
"eslint-plugin-sonarjs": "^3.0.2",
2020
"eslint-plugin-unused-imports": "^4.0.0"
2121
},
22+
"devDependencies": {
23+
"@mikecbrant/prettier-config": "workspace:*"
24+
},
2225
"publishConfig": {
2326
"access": "public"
2427
},

0 commit comments

Comments
 (0)