This action for Changesets creates a pull request with all of the package versions updated and changelogs updated and when there are new changesets on master, the PR will be updated. When you're ready, you can merge the pull request and publish the packages to npm manually, push the tags and then run the action to create GitHub releases with corresponding changelogs.
- version - The command to update version, edit CHANGELOG, read and delete changesets. Default to
changeset versionif not provided - commit - The commit message to use. Default to
Version Packages - title - The pull request title. Default to
Version Packages - setupGitUser - Sets up the git user for commits as
"github-actions[bot]". Default totrue
- published - A boolean value to indicate whether a publishing is happened or not
- publishedPackages - A JSON array to present the published packages. The format is
[{"name": "@xx/xx", "version": "1.2.0"}, {"name": "@xx/xy", "version": "0.8.9"}]
Create a file at .github/workflows/release.yml with the following content.
name: Release
on:
push:
branches:
- master
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
- name: Setup Node.js 12.x
uses: actions/setup-node@v2
with:
node-version: 12.x
- name: Install Dependencies
run: yarn
- name: Create Release Pull Request
uses: changesets/action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}If you need to add additional logic to the version command, you can do so by using a version script.
If the version script is present, this action will run that script instead of changeset version, so please make sure that your script calls changeset version at some point. All the changes made by the script will be included in the PR.
name: Release
on:
push:
branches:
- master
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- 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: 12.x
- name: Install Dependencies
run: yarn
- name: Create Release Pull Request
uses: changesets/action@v1
with:
# this expects you to have a npm script called version that runs some logic and then calls `changeset version`.
version: yarn version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}If you are using Yarn Plug'n'Play, you should use a custom version command so that the action can resolve the changeset CLI:
- uses: changesets/action@v1
with:
version: yarn changeset version
...