Skip to content

Commit

Permalink
chore: setup changesets to manage versioning and changelogs
Browse files Browse the repository at this point in the history
  • Loading branch information
SiTaggart committed Jan 28, 2021
1 parent fdba10a commit c132b52
Show file tree
Hide file tree
Showing 6 changed files with 468 additions and 49 deletions.
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/master/docs/common-questions.md)
13 changes: 13 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://unpkg.com/@changesets/config@1.4.0/schema.json",
"changelog": [
"@changesets/changelog-github",
{ "repo": "twilio-labs/paste" }
],
"commit": false,
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
75 changes: 43 additions & 32 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,57 @@
name: Package Publish
name: Publish

on:
push:
paths:
- "packages/**"
branches:
- main

jobs:
deploy:
components:
name: Publish components and Storybook
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'chore(release): publish')"
strategy:
matrix:
node-version: [12.18.x]

if: "!contains(github.event.head_commit.message, 'chore(release): version packages')"
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- name: Checkout Repo
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Node.js 12.x
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
node-version: 12.x
registry-url: "https://registry.npmjs.org"
scope: twilio-paste
- name: Checkout full history set email and user
run: git remote rm origin && git remote add origin "https://$GH_USER_NAME:$GH_TOKEN@github.com/twilio-labs/paste.git" && git fetch && git config user.email paste@twilio.com && git config user.name PasteBot && git checkout "${GITHUB_REF:11}"
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GH_USER_NAME: ${{ secrets.GH_USER_NAME }}
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Bootstrap repository
run: yarn bootstrap
- name: Build packages
run: yarn build
- name: Run type checker
run: yarn type-check
- name: Run eslint
run: yarn lint
- name: Run tests
run: yarn test
- name: Publish packages
run: yarn release:stable:ci

- id: yarn-cache
name: Get Yarn cache path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
name: Load Yarn cache
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn
- name: Install Dependencies
run: yarn install --frozen-lockfile && yarn bootstrap

- name: Setup CI Git User
run: |
git config --global user.email "paste@twilio.com"
git config --global user.name "PasteBot"
- name: "Create Pull Request or Publish to npm"
uses: changesets/action@master
with:
publish: yarn release
commit: "chore(release): version packages"
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

- name: Deploy storybook
run: yarn release:storybook
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<h1 align="center">Paste</h1>
<p align="center">Paste is a design system used to build accessible, consistent, and high quality customer experiences at Twilio. Paste is open source and contributions are welcome.</p>
<p align="center">
<a href="https://github.com/twilio-labs/.github/blob/master/CODE_OF_CONDUCT.md"><img alt="Code of Conduct" src="https://img.shields.io/badge/%F0%9F%92%96-Code%20of%20Conduct-blueviolet.svg?style=flat-square"></a>
<a href="https://github.com/twilio-labs/.github/blob/master/CODE_OF_CONDUCT.md"><img alt="Code of Conduct" src="https://img.shields.io/badge/%F0%9F%92%96-Code%20of%20Conduct-blueviolet.svg?style=flat-square"></a>
<a href="http://makeapullrequest.com"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square" alt="PRs Welcome" /></a>
</p>
<hr>
Expand Down Expand Up @@ -33,6 +33,20 @@ For more commands, please reference the [package.json file](https://github.com/t

Before contributing, please make sure that you read our [Contributing Guidelines](https://github.com/twilio-labs/paste/blob/main/CONTRIBUTING.md) and agree with our [Code of Conduct.](https://github.com/twilio-labs/.github/blob/main/CODE_OF_CONDUCT.md)

### Changesets

Each change to a package must come with a [changeset](https://github.com/atlassian/changesets). You should have an individual changeset for each package you have touched.

To create a changeset you can run:

```
yarn changeset
```

Follow the prompts shown to you in your terminal.

Instructions on how to use the cli tool can be found [here](https://github.com/atlassian/changesets/blob/master/packages/cli/README.md), but all you should need to do is generate a changeset and commit it with your Pull Request.

### Maintainers

This project is maintained by the [design systems team](https://github.com/orgs/twilio-labs/teams/design-systems).
Expand Down Expand Up @@ -109,6 +123,10 @@ When a package has a peer dependency on another internal package in the mono rep
}
```

## Releasing

Releasing Paste happens via CI/CD using [Changesets](https://github.com/atlassian/changesets).

## License

[MIT](/LICENSE)
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,32 @@
"build:theme-designer": "yarn workspace @twilio-paste/theme-designer build",
"build:props": "lerna run build:props --ignore @twilio-paste/website --concurrency 2",
"pre-push": "concurrently \"yarn:lint\" \"yarn:test\" \"yarn:prettier\" \"yarn:type-check\"",
"release": "yarn lerna publish -m 'chore(release): publish' --conventional-commits --canary --preid beta --dist-tag next",
"release:stable": "yarn lerna publish -m 'chore(release): publish' --conventional-commits",
"release:stable:ci": "yarn lerna publish -y --loglevel verbose -m 'chore(release): publish' --conventional-commits",
"release:stable:npm-failed": "yarn lerna publish from-package -y --loglevel verbose -m 'chore(release): publish' --conventional-commits",
"prerelease": "yarn build && yarn lint && yarn test",
"release": "yarn changeset publish",
"release:next": "yarn lerna publish -m 'chore(release): pre release' --conventional-commits --canary --preid beta --dist-tag next",
"release:storybook": "yarn build:storybook && gh-pages -d docs",
"version": "node ./tools/build/version.js",
"clean": "node ./tools/build/clean-repo.js && lerna clean --yes && lerna run clean && yarn && yarn bootstrap",
"clean:full": "node ./tools/build/clean-repo.js && lerna clean --yes && lerna run clean && rm -rf node_modules/ && yarn && yarn bootstrap",
"clean:core": "yarn workspace @twilio-paste/core clean",
"pre-test": "node ./tools/build/pre-test.js",
"serve:website": "yarn workspace @twilio-paste/website serve",
"test": "yarn pre-test && concurrently \"yarn:test:packages\" \"yarn:test:tools\"",
"test:packages": "node --experimental-worker ./node_modules/.bin/jest --maxWorkers=2 ./packages/",
"test:tools": "node --experimental-worker ./node_modules/.bin/jest --maxWorkers=2 ./tools/ -c ./tools/jest.config.js",
"test:coverage": "yarn pre-test && node --experimental-worker ./node_modules/.bin/jest --maxWorkers=2 --coverage",
"test:vrt": "eyes-storybook",
"test:website": "start-server-and-test 'yarn serve:website' http://localhost:9000 'yarn run cypress run --record --spec './cypress/integration/**/*.spec.ts''",
"test:website-gui": "start-server-and-test 'yarn serve:website' http://localhost:9000 'yarn run cypress open'",
"serve:website": "yarn workspace @twilio-paste/website serve",
"package-size-action-build": "yarn bootstrap && yarn build",
"prettier": "prettier --list-different '{.storybook,packages}/**/*.{ts,tsx}'",
"prettier-clean": "prettier --write '{.storybook,packages}/**/*.{ts,tsx}'",
"lint": "yarn pre-test && eslint --ext .tsx,.ts ./packages/** --no-error-on-unmatched-pattern",
"type-check": "lerna run type-check",
"chromatic": "chromatic",
"packages:check": "manypkg check",
"packages:fix": "manypkg fix"
"packages:fix": "manypkg fix",
"changeset": "changeset"
},
"dependencies": {
"@applitools/eyes-storybook": "^3.16.3",
Expand All @@ -70,6 +70,7 @@
"@babel/preset-react": "^7.8.3",
"@babel/preset-typescript": "^7.12.7",
"@babel/register": "^7.8.3",
"@changesets/cli": "^2.13.1",
"@commitlint/cli": "8.0.0",
"@commitlint/config-conventional": "8.0.0",
"@emotion/babel-preset-css-prop": "^10.0.14",
Expand Down
Loading

0 comments on commit c132b52

Please sign in to comment.