Skip to content

Commit

Permalink
Manage releases using changesets (#625)
Browse files Browse the repository at this point in the history
* chore(deps-dev): add @changesets/cli

* chore: yarn changeset init

* chore: update changeset.config.access to public

* chore: add changesets/action to publish new version

* chore: rename call-build to call-test

* fix: remove setting yarn using corepack
  • Loading branch information
trivikr authored Nov 7, 2024
1 parent af78edc commit a0c7424
Show file tree
Hide file tree
Showing 7 changed files with 606 additions and 14 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/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": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
9 changes: 9 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: pull_request

on:
pull_request:
branches: [main]

jobs:
call-test:
uses: ./.github/workflows/test.yml
33 changes: 33 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: push

on:
push:
branches: [main]

jobs:
call-test:
uses: ./.github/workflows/test.yml
release:
needs: call-test
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: yarn

- run: yarn

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: yarn release
title: Publish <version>
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
8 changes: 2 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ name: test

on:
workflow_call:
pull_request:
branches: [main]
push:
branches: [main]

jobs:
build:
Expand All @@ -16,9 +12,9 @@ jobs:
node-version: [16.x, 18.x, 20.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: yarn
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"scripts": {
"clean": "rm -rf dist/",
"prepare": "yarn clean && cp -R src/ dist/",
"test": "jest --bail"
"test": "jest --bail",
"release": "changeset publish"
},
"bin": {
"jscodeshift": "./bin/jscodeshift.js"
Expand Down Expand Up @@ -53,6 +54,7 @@
},
"devDependencies": {
"@babel/eslint-parser": "^7.24.7",
"@changesets/cli": "^2.27.8",
"eslint": "8.56.0",
"jest": "^29.7.0",
"jsdoc": "^4.0.3"
Expand Down
Loading

0 comments on commit a0c7424

Please sign in to comment.