Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(tooling): setup release pipeline #2342

Merged
merged 3 commits into from
Dec 10, 2024
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
11 changes: 0 additions & 11 deletions .changeset/config.json

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/bundle-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Bundle-size
on:
pull_request:
branches:
- main
- next

env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
Expand Down Expand Up @@ -31,7 +31,7 @@ jobs:
run: yarn install --immutable

- name: Build packages
run: yarn build --filter=!@react-spring/doc
run: yarn build --filter=!@react-spring/docs

- uses: preactjs/compressed-size-action@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Checks
on:
push:
branches:
- 'main'
- next
pull_request: {}

env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/experimental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: yarn install --immutable

- name: Build
run: yarn build-ci
run: yarn build:ci

- run: ./scripts/version-and-publish.sh
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:

- name: Build
if: steps.version.outputs.NEXT_VERSION
run: yarn build-ci
run: yarn build:ci

- name: Setup npmrc
if: steps.version.outputs.NEXT_VERSION
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
name: Release Please

on:
push:
branches:
- main

permissions:
contents: read
pull-requests: write

env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v4
id: release

# Publish to NPM on new releases
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.releases_created }}

- uses: actions/setup-node@v4
if: ${{ steps.release.outputs.releases_created }}
with:
cache: yarn
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'

- name: Install
if: ${{ steps.release.outputs.releases_created }}
run: yarn install --immutable

- name: Build
if: ${{ steps.release.outputs.releases_created }}
run: yarn build:ci

# Release Please has already incremented versions and published tags, so we just
# need to publish all unpublished versions to NPM here
- run: yarn workspaces foreach npm publish --access=public
if: ${{ steps.release.outputs.releases_created }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
10 changes: 5 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Tests
on:
push:
branches:
- 'main'
- next
pull_request: {}

env:
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
run: yarn install --immutable

- name: Build
run: yarn build-ci --filter=!@react-spring/docs
run: yarn build:ci

- name: Pack
run: yarn package
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
run: yarn install --immutable

- name: Build
run: yarn build-ci
run: yarn build:ci

- name: Test
run: yarn test:unit
Expand Down Expand Up @@ -147,7 +147,7 @@ jobs:
run: yarn add typescript@${{ matrix.ts }}

- name: Build
run: yarn build-ci
run: yarn build:ci

- name: Test
run: |
Expand Down Expand Up @@ -177,7 +177,7 @@ jobs:
# run: yarn install --immutable

# - name: Build
# run: yarn build-ci
# run: yarn build:ci

# - name: Test
# run: yarn test:e2e
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/validate-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "Validate PR"

on:
pull_request:

permissions:
pull-requests: read

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71 changes: 0 additions & 71 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,74 +20,3 @@ Be sure your commit messages follow this specification: https://www.conventional
### Windows permission errors

Some Windows users may need to [enable developer mode](https://howtogeek.com/292914/what-is-developer-mode-in-windows-10) if experiencing `EPERM: operation not permitted, symlink` with Preconstruct. If this persists, you might be running on an unsupported drive/format. In which case, consider using [Docker](https://docs.docker.com/docker-for-windows).

### Duplicate `react` errors

React 16.8+ has global state to support its "hooks" feature, so you need to ensure only one copy of `react` exists in your program. Otherwise, you'll most likely see [this error](https://reactjs.org/warnings/invalid-hook-call-warning.html). Please try the following solutions, and let us know if it still doesn't work for you.

- **For `create-react-app` users:** Follow this guide: https://github.com/facebook/react/issues/13991#issuecomment-496383268

- **For `webpack` users:** Add an alias to `webpack.config.js` like this:

```js
alias: {
react: path.resolve('node_modules/react'),
}
```

- **For `gatsby` users:** Install `gatsby-plugin-alias-imports` and add this to your `gatsby-config.js` module:
```js
{
resolve: `gatsby-plugin-alias-imports`,
options: {
alias: {
react: path.resolve('node_modules/react'),
},
},
},
```

# Publishing

We use [`changesets`](https://github.com/atlassian/changesets) to publish our package now.
All our dependencies are fixed using ~ after [1414](https://github.com/pmndrs/react-spring/issues/1414) but luckily changesets will bump them for every minor version we release.

## Simple release

You want to release some new features that haven't been released yet:

```shell
yarn changeset:add
```

Follow the prompt to flag which packages need to update although with `react-spring` we keep all our packages at the same version.

Then you'll run:

```shell
yarn vers
```

This will update all the packages correctly according to what version you just set with the `add` script & possibly update the deps within those packages.

Finally:

```shell
yarn release
```

This will build the packages, publish them & push the tags to github to signify a new release. Please then update the `releases` on github & the changelog on `react-spring.io`

## Prerelease

Everything above applies but you must first run:

```shell
yarn changeset pre enter beta | alpha | next
```

If you find you're stuck in a prerelease and trying to do a Simple Release, try running:

```shell
yarn changeset pre exit
```
7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
]
},
"scripts": {
"build-ci": "turbo run build --filter=!@react-spring/doc",
"build:ci": "turbo run build --filter=!@react-spring/docs",
"build": "turbo run build",
"changeset": "changeset",
"clean": "turbo run clean",
Expand All @@ -48,9 +48,7 @@
"test:unit": "jest",
"test:cov": "jest --coverage",
"test:ts": "tsc --noEmit",
"test:e2e": "start-server-and-test 'yarn vite serve packages/parallax/test --host' http-get://localhost:3000 'yarn cypress run'",
"release": "yarn clean && yarn && yarn build && yarn test:ts && yarn test:unit && yarn changeset publish --no-git-tag",
"vers": "yarn changeset version"
"test:e2e": "start-server-and-test 'yarn vite serve packages/parallax/test --host' http-get://localhost:3000 'yarn cypress run'"
},
"commitlint": {
"extends": [
Expand All @@ -63,7 +61,6 @@
}
},
"devDependencies": {
"@changesets/cli": "2.27.9",
"@commitlint/cli": "19.5.0",
"@commitlint/config-conventional": "19.5.0",
"@react-three/fiber": "8.17.10",
Expand Down
25 changes: 25 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"always-link-local": true,
"bootstrap-sha": "8b09751fbde6c20e542312db75c48df61714e3b1",
"plugins": [
{
"type": "node-workspace",
"updatePeerDependencies": true
}
],
"packages": {
"packages/animated": {},
"packages/core": {},
"packages/parallax": {},
"packages/rafz": {},
"packages/react-spring": {},
"packages/shared": {},
"packages/types": {},
"targets/konva": {},
"targets/nativ": {},
"targets/three": {},
"targets/web": {},
"targets/zdog": {}
}
}
Loading
Loading