Skip to content

Commit 496c932

Browse files
ci: prepare for trusted publishing (#6032)
1 parent ec90441 commit 496c932

File tree

8 files changed

+28
-36
lines changed

8 files changed

+28
-36
lines changed

.github/workflows/autofix.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ jobs:
1919
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
2020
steps:
2121
- name: Checkout
22-
uses: actions/checkout@v4.2.2
22+
uses: actions/checkout@v6.0.1
2323
- name: Setup Tools
2424
uses: tanstack/config/.github/setup@main
2525
- name: Fix formatting
26-
run: pnpm prettier:write
26+
run: pnpm format
2727
- name: Generate labeler config
2828
run: pnpm labeler-generate
2929
- name: Apply fixes

.github/workflows/labeler.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
name: Pull Request Labeler
1+
name: Labeler
22

33
on:
44
- pull_request_target
55

6+
permissions:
7+
contents: read
8+
pull-requests: write
9+
610
jobs:
711
labeler:
812
runs-on: ubuntu-latest

.github/workflows/pr.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: pr
1+
name: PR
22

33
on:
44
pull_request:
@@ -13,6 +13,7 @@ env:
1313

1414
permissions:
1515
contents: read
16+
pull-requests: write
1617

1718
jobs:
1819
test:
@@ -22,15 +23,15 @@ jobs:
2223
TSR_TMP_DIR: ./tmp
2324
steps:
2425
- name: Checkout
25-
uses: actions/checkout@v4.2.2
26+
uses: actions/checkout@v6.0.1
2627
with:
2728
fetch-depth: 0
2829
- name: Start Nx Agents
2930
run: npx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yaml"
3031
- name: Setup Tools
3132
uses: tanstack/config/.github/setup@main
3233
- name: Get base and head commits for `nx affected`
33-
uses: nrwl/nx-set-shas@v4.1.2
34+
uses: nrwl/nx-set-shas@v4.4.0
3435
with:
3536
main-branch-name: main
3637
- name: Run Checks
@@ -43,7 +44,7 @@ jobs:
4344
runs-on: ubuntu-latest
4445
steps:
4546
- name: Checkout
46-
uses: actions/checkout@v4.2.2
47+
uses: actions/checkout@v6.0.1
4748
with:
4849
fetch-depth: 0
4950
- name: Setup Tools
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: ci
1+
name: Release
22

33
on:
44
workflow_dispatch:
@@ -20,15 +20,16 @@ env:
2020
permissions:
2121
contents: write
2222
id-token: write
23+
pull-requests: write
2324

2425
jobs:
2526
test:
26-
name: Build & Test
27+
name: Release
2728
if: github.repository_owner == 'TanStack'
2829
runs-on: ubuntu-latest
2930
steps:
3031
- name: Checkout
31-
uses: actions/checkout@v4.2.2
32+
uses: actions/checkout@v6.0.1
3233
with:
3334
fetch-depth: 0
3435
- name: Start Nx Agents
@@ -44,9 +45,7 @@ jobs:
4445
run: |
4546
git config --global user.name 'Tanner Linsley'
4647
git config --global user.email 'tannerlinsley@users.noreply.github.com'
47-
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
4848
pnpm run cipublish
4949
env:
5050
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
5251
TAG: ${{ inputs.tag }}

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ TanStack Router is a type-safe router with built-in caching and URL state manage
4848
- **Critical**: Always run unit and type tests during development - do not proceed if they fail
4949
- **Test types:** `pnpm test:unit`, `pnpm test:types`, `pnpm test:eslint`, `pnpm test:e2e`, `pnpm test:build`
5050
- **Full CI suite:** `pnpm test:ci`
51-
- **Fix formatting:** `pnpm prettier:write`
51+
- **Fix formatting:** `pnpm format`
5252
- **Efficient targeted testing workflow:**
5353
1. **Affected only:** `npx nx affected --target=test:unit` (compares to main branch)
5454
2. **Specific packages:** `npx nx run @tanstack/react-router:test:unit`

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"test:pr": "nx affected --targets=test:eslint,test:unit,test:e2e,test:types,test:build,build",
1616
"test:ci": "nx run-many --targets=test:eslint,test:unit,test:e2e,test:types,test:build,build",
1717
"test:eslint": "nx affected --target=test:eslint --exclude=examples/**,e2e/**",
18-
"test:format": "pnpm run prettier --check",
1918
"test:unit": "nx affected --target=test:unit --exclude=examples/**,e2e/**",
2019
"test:unit:dev": "pnpm run test:unit && nx watch --all -- pnpm run test:unit",
2120
"test:build": "nx affected --target=test:build --exclude=examples/**",
@@ -25,12 +24,11 @@
2524
"build:all": "nx run-many --target=build --exclude=examples/** --exclude=e2e/**",
2625
"watch": "pnpm run build:all && nx watch --all -- pnpm run build:all",
2726
"dev": "pnpm run watch",
28-
"prettier": "prettier --experimental-cli --ignore-unknown '**/*'",
29-
"prettier:write": "pnpm run prettier --write",
27+
"format": "prettier --experimental-cli --ignore-unknown '**/*' --write",
3028
"cipublish": "node scripts/publish.js",
3129
"gpt-generate": "node gpt/generate.js",
3230
"set-ts-version": "node scripts/set-ts-version.js",
33-
"labeler-generate": "node scripts/generate-labeler-config.mjs",
31+
"labeler-generate": "node scripts/generate-labeler-config.ts",
3432
"cleanup-empty-packages": "node scripts/cleanup-empty-packages.mjs",
3533
"test:docs": "node scripts/verify-links.ts"
3634
},
Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,13 @@ import * as fs from 'node:fs'
22
import * as path from 'node:path'
33
import * as prettier from 'prettier'
44

5-
/**
6-
* Pairs of package labels and their corresponding paths
7-
* @typedef {[string, string]} LabelerPair
8-
*/
9-
10-
/**
11-
* @returns {Array<LabelerPair>} Pairs of package labels and their corresponding paths
12-
*/
13-
function readPairsFromFs() {
5+
/** Pairs of package labels and their corresponding paths */
6+
type LabelerPair = [string, string]
7+
8+
function readPairsFromFs(): Array<LabelerPair> {
149
const ignored = new Set(['.DS_Store'])
1510

16-
/** @type {Array<LabelerPair>} */
17-
const pairs = []
11+
const pairs: Array<LabelerPair> = []
1812

1913
// Add subfolders in the packages folder, i.e. packages/**
2014
fs.readdirSync(path.resolve('packages'))
@@ -40,11 +34,7 @@ function readPairsFromFs() {
4034
return pairs
4135
}
4236

43-
/**
44-
* @param {Array<LabelerPair>} pairs
45-
* @returns {Promise<string>} YAML string for the labeler config
46-
*/
47-
async function generateLabelerYaml(pairs) {
37+
async function generateLabelerYaml(pairs: Array<LabelerPair>): Promise<string> {
4838
function s(n = 1) {
4939
return ' '.repeat(n)
5040
}
@@ -96,7 +86,7 @@ async function run() {
9686
// Convert the pairs into valid yaml
9787
const yamlStr = await generateLabelerYaml(pairs)
9888

99-
// Write to '.github/labeler.yml'
89+
// Write to 'labeler-config.yml'
10090
const configPath = path.resolve('labeler-config.yml')
10191
fs.writeFileSync(configPath, yamlStr, {
10292
encoding: 'utf-8',

tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"forceConsistentCasingInFileNames": true,
1212
"isolatedModules": true,
1313
"lib": ["DOM", "DOM.Iterable", "ES2022"],
14-
"module": "ES2022",
14+
"module": "ESNext",
1515
"moduleResolution": "Bundler",
1616
"noEmit": true,
1717
"noImplicitReturns": true,
@@ -24,5 +24,5 @@
2424
"stripInternal": true,
2525
"target": "ES2020"
2626
},
27-
"include": ["eslint.config.js", "prettier.config.js", "scripts"]
27+
"include": ["*.config.*", "scripts"]
2828
}

0 commit comments

Comments
 (0)