Skip to content

Commit e33ceda

Browse files
authored
refactor: replace semantic-release with changesets (#118)
refactor: start moving to changesets
1 parent add1794 commit e33ceda

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+17475
-35921
lines changed

.changeset/config.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": ["@changesets/changelog-github", {"repo": "sanity-io/code-input"}],
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch"
10+
}

.changeset/social-moments-rest.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sanity/code-input': patch
3+
---
4+
5+
Replace `import styled from 'styled-components'` with `import {styled} from 'styled-components'`

.eslintignore

Lines changed: 0 additions & 10 deletions
This file was deleted.

.eslintrc.cjs

Lines changed: 0 additions & 46 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Auto format
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
concurrency: ${{ github.workflow }}-${{ github.ref }}
8+
9+
permissions:
10+
contents: read # for checkout
11+
12+
jobs:
13+
if-needed:
14+
uses: sanity-io/.github/.github/workflows/format.yml@main
15+
secrets: inherit

.github/workflows/main.yml

Lines changed: 17 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,32 @@
1-
---
2-
name: CI & Release
3-
4-
# Workflow name based on selected inputs. Fallback to default Github naming when expression evaluates to empty string
5-
run-name: >-
6-
${{
7-
inputs.release && inputs.test && 'Build ➤ Test ➤ Publish to NPM' ||
8-
inputs.release && !inputs.test && 'Build ➤ Skip Tests ➤ Publish to NPM' ||
9-
github.event_name == 'workflow_dispatch' && inputs.test && 'Build ➤ Test' ||
10-
github.event_name == 'workflow_dispatch' && !inputs.test && 'Build ➤ Skip Tests' ||
11-
''
12-
}}
1+
name: CI
132

143
on:
15-
# Build on pushes branches that have a PR (including drafts)
164
pull_request:
17-
# Build on commits pushed to branches without a PR if it's in the allowlist
5+
branches: [main]
186
push:
197
branches: [main]
20-
# https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
21-
workflow_dispatch:
22-
inputs:
23-
test:
24-
description: Run tests
25-
required: true
26-
default: true
27-
type: boolean
28-
release:
29-
description: Release new version
30-
required: true
31-
default: false
32-
type: boolean
338

349
concurrency:
35-
# On PRs builds will cancel if new pushes happen before the CI completes, as it defines `github.head_ref` and gives it the name of the branch the PR wants to merge into
36-
# Otherwise `github.run_id` ensures that you can quickly merge a queue of PRs without causing tests to auto cancel on any of the commits pushed to main.
37-
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
38-
cancel-in-progress: true
10+
group: ${{ github.workflow }}-${{ github.ref }}
3911

4012
jobs:
41-
log-the-inputs:
42-
name: Log inputs
43-
runs-on: ubuntu-latest
44-
steps:
45-
- run: |
46-
echo "Inputs: $INPUTS"
47-
env:
48-
INPUTS: ${{ toJSON(inputs) }}
49-
5013
build:
5114
runs-on: ubuntu-latest
5215
name: Lint & Build
5316
steps:
54-
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3
55-
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
17+
- uses: actions/checkout@v5
18+
- uses: pnpm/action-setup@v4
19+
- uses: actions/setup-node@v6
5620
with:
57-
cache: npm
21+
cache: pnpm
5822
node-version: lts/*
59-
- run: npm ci
60-
# Linting can be skipped
61-
- run: npm run lint --if-present
62-
if: github.event.inputs.test != 'false'
63-
# But not the build script, as semantic-release will crash if this command fails so it makes sense to test it early
64-
- run: npm run prepublishOnly --if-present
23+
- run: pnpm install
24+
- run: pnpm type-check
25+
- run: pnpm lint -f gha --max-warnings 0
26+
- run: pnpm prepublishOnly
6527

6628
test:
6729
needs: build
68-
# The test matrix can be skipped, in case a new release needs to be fast-tracked and tests are already passing on main
69-
if: github.event.inputs.test != 'false'
7030
runs-on: ${{ matrix.os }}
7131
name: Node.js ${{ matrix.node }} / ${{ matrix.os }}
7232
strategy:
@@ -91,42 +51,11 @@ jobs:
9151
run: |
9252
git config --global core.autocrlf false
9353
git config --global core.eol lf
94-
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3
95-
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
54+
- uses: actions/checkout@v5
55+
- uses: pnpm/action-setup@v4
56+
- uses: actions/setup-node@v6
9657
with:
97-
cache: npm
58+
cache: pnpm
9859
node-version: ${{ matrix.node }}
99-
- run: npm i
100-
- run: npm test
101-
102-
release:
103-
needs: [build, test]
104-
# only run if opt-in during workflow_dispatch
105-
if: always() && github.event.inputs.release == 'true' && needs.build.result != 'failure' && needs.test.result != 'failure' && needs.test.result != 'cancelled'
106-
runs-on: ubuntu-latest
107-
name: Semantic release
108-
steps:
109-
- uses: actions/create-github-app-token@v2
110-
id: app-token
111-
with:
112-
app-id: ${{ secrets.ECOSPARK_APP_ID }}
113-
private-key: ${{ secrets.ECOSPARK_APP_PRIVATE_KEY }}
114-
- uses: actions/checkout@v4
115-
with:
116-
# Need to fetch entire commit history to
117-
# analyze every commit since last release
118-
fetch-depth: 0
119-
# Uses generated token to allow pushing commits back
120-
token: ${{ steps.app-token.outputs.token }}
121-
# Make sure the value of GITHUB_TOKEN will not be persisted in repo's config
122-
persist-credentials: false
123-
- uses: actions/setup-node@v4
124-
with:
125-
cache: npm
126-
node-version: lts/*
127-
- run: npm ci
128-
# Branches that will release new versions are defined in .releaserc.json
129-
- run: npx semantic-release
130-
env:
131-
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
132-
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
60+
- run: pnpm install
61+
- run: pnpm test

.github/workflows/release.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency: ${{ github.workflow }}-${{ github.ref }}
9+
10+
permissions:
11+
contents: read # for checkout
12+
13+
jobs:
14+
release:
15+
uses: sanity-io/.github/.github/workflows/changesets.yml@main
16+
permissions:
17+
contents: read # for checkout
18+
id-token: write # to enable use of OIDC for npm provenance
19+
with:
20+
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
21+
secrets: inherit

.github/workflows/renovate.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Add changeset to Renovate updates
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, synchronize]
6+
7+
concurrency: ${{ github.workflow }}-${{ github.ref }}
8+
9+
permissions:
10+
contents: read # for checkout
11+
12+
jobs:
13+
call:
14+
uses: sanity-io/.github/.github/workflows/changesets-from-conventional-commits.yml@main
15+
if: github.event.pull_request.user.login == 'renovate[bot]'
16+
secrets: inherit

.husky/commit-msg

Lines changed: 0 additions & 4 deletions
This file was deleted.

.npmignore

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)