Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/actions/ci-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Setup CI
description: Setup CI
Comment on lines +1 to +2
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out of curiosity - why do we need description too? I can't find the docs for this description field

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a weird one I think. In VS Code, I have the github actions extension (official) installed, which gives nice intellisense and stuff. For some reason it marked the whole file red without the description, so I added it to please it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


inputs:
node-version:
description: Node.js version
required: false
default: 24
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea with defaulting to 22 was that our CI should test against the oldest supported version. I assume you have decided it's an overkill here - that's fine with me, I'm just doublechecking

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I figured it's simpler to only test node 24


runs:
using: composite
steps:
- name: Set up pnpm
uses: pnpm/action-setup@91ab88e2619ed1f46221f0ba42d1492c02baf788 # v6.0.6

- name: Set up Node.js ${{ inputs.node-version }}
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: ${{ inputs.node-version }}
cache: pnpm

- name: Install dependencies
shell: bash
run: pnpm install
15 changes: 4 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
branches:
- main

permissions: {}

jobs:
test:
name: Test
Expand All @@ -18,23 +20,14 @@ jobs:
- name: Check out repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Set up pnpm
uses: pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d # v6.0.5

- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24
cache: pnpm
- uses: ./.github/actions/ci-setup

# Deno is needed for tests only
- name: Set up Deno
uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282 # v2.0.4
with:
deno-version: 2.x

- name: Install dependencies
run: pnpm install

- name: Build
run: pnpm build

Expand Down
43 changes: 29 additions & 14 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,48 @@ on:

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

permissions: {}

jobs:
version:
name: Version
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
hasChangesets: ${{ steps.changesets.outputs.hasChangesets }}
permissions:
contents: write # to create version commits (changesets/action)
pull-requests: write # to create pull request (changesets/action)
Comment thread
bluwy marked this conversation as resolved.
steps:
- name: Check out repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- uses: ./.github/actions/ci-setup

- name: Create or update release pull request
id: changesets
uses: changesets/action@63a615b9cd06ba9a3e6d13796c7fbcb080a60a0b # v1.8.0

publish:
name: Publish
if: github.repository == 'changesets/format'
if: needs.version.outputs.hasChangesets == 'false'
needs: version
runs-on: ubuntu-latest
environment: npm
timeout-minutes: 10
permissions:
contents: write # to create release (changesets/action)
pull-requests: write # to create pull request (changesets/action)
id-token: write # to use OpenID Connect token for trusted publishing (changesets/action)
steps:
- name: Check out repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Set up pnpm
uses: pnpm/action-setup@91ab88e2619ed1f46221f0ba42d1492c02baf788 # v6.0.6

- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24
cache: pnpm

- name: Install dependencies
run: pnpm install
- uses: ./.github/actions/ci-setup

- name: Build
run: pnpm build

- name: Create release PR or publish to npm
- name: Publish to npm
uses: changesets/action@63a615b9cd06ba9a3e6d13796c7fbcb080a60a0b # v1.8.0
with:
publish: pnpm release
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@changesets/format",
"version": "0.0.1",
"version": "0.1.0",
"description": "Detect and format files",
"license": "MIT",
"author": "Changesets",
Expand All @@ -15,7 +15,8 @@
"test": "vitest",
"format": "oxfmt",
"lint": "oxfmt --check",
"typecheck": "tsc"
"typecheck": "tsc",
"release": "changeset publish"
},
"dependencies": {
"package-manager-detector": "^1.6.0"
Expand All @@ -30,5 +31,8 @@
"typescript": "~6.0.3",
"vitest": "^4.1.5"
},
"engines": {
"node": "^22.11 || ^24 || >=26"
},
"packageManager": "pnpm@11.1.0"
}