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

Introduce changesets for versioning and publishing #565

Merged
merged 3 commits into from
Jan 26, 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
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
6 changes: 6 additions & 0 deletions .github/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ yarn install || corepack yarn install
This means running `yarn build` in the root will build all packages in parallel.
The same goes for `lint` and `format`.

## Changesets

We use [changesets](https://github.com/changesets/changesets) to manage versioning, changelogs and publishing.
This means when you contribute a PR you have to run `yarn changeset` to indicate the semver bump you are making
and to add a changelog entry.

## Tests

You can run tests for individual packages by running a Yarn workspace command.
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: release

on: workflow_dispatch

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

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Decrypt keyfile
run: ./.github/scripts/decrypt_secret.sh
env:
KEYFILE_PASSPHRASE: ${{secrets.KEYFILE_PASSPHRASE}}

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: lts/*

- name: Install dependencies
run: corepack yarn install

- name: Build
run: corepack yarn build

- name: Run linters
run: corepack yarn lint

- name: Run tests
run: corepack yarn test
env:
AWS_BUCKET: ${{secrets.AWS_BUCKET}}
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}
AWS_REGION: ${{secrets.AWS_REGION}}

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: corepack yarn release:local
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@
"demo:s3": "yarn workspace demo start:s3",
"lint": "turbo run lint",
"format": "turbo run format",
"test": "turbo run test --concurrency 1"
"test": "turbo run test --concurrency 1",
"release": "gh actions run release",
"release:local": "turbo run build && changesets publish"
},
"devDependencies": {
"@changesets/cli": "^2.27.1",
"eslint": "^8.56.0",
"eslint-config-custom": "workspace:*",
"eslint-plugin-prettier": "^4.2.1",
Expand Down
Loading
Loading