mirror of
https://github.com/changesets/action
synced 2026-10-26 16:39:56 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
983cabb332 |
@@ -5,8 +5,6 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
changesets:
|
changesets:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -1,11 +1,5 @@
|
|||||||
# @changesets/action
|
# @changesets/action
|
||||||
|
|
||||||
## 1.2.2
|
|
||||||
|
|
||||||
### Patch Changes
|
|
||||||
|
|
||||||
- [#161](https://github.com/changesets/action/pull/161) [`52c9ce7`](https://github.com/changesets/action/commit/52c9ce75d9d8a14ea2d75e4157b0c15b7a4ac313) Thanks [@bicknellr](https://github.com/bicknellr)! - Change directory to `cwd` before running git user setup. This fixes an issue when the action starts its execution not in a git repository.
|
|
||||||
|
|
||||||
## 1.2.1
|
## 1.2.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -128,51 +128,6 @@ For example, you can add a step before running the Changesets GitHub Action:
|
|||||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Custom Publishing
|
|
||||||
|
|
||||||
If you want to hook into when publishing should occur but have your own publishing functionality you can utilize the `hasChangesets` output.
|
|
||||||
|
|
||||||
Note that you might need to account for things already being published in your script because a commit without any new changesets can always land on your base branch after a successful publish. In such a case you need to figure out on your own how to skip over the actual publishing logic or handle errors gracefully as most package registries won't allow you to publish over already published version.
|
|
||||||
|
|
||||||
```yml
|
|
||||||
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 or Publish to npm
|
|
||||||
id: changesets
|
|
||||||
uses: changesets/action@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Publish
|
|
||||||
if: steps.changesets.outputs.hasChangesets == 'false'
|
|
||||||
# You can do something when a publish should happen.
|
|
||||||
run: yarn publish
|
|
||||||
```
|
|
||||||
|
|
||||||
#### With version script
|
#### With version script
|
||||||
|
|
||||||
If you need to add additional logic to the version command, you can do so by using a version script.
|
If you need to add additional logic to the version command, you can do so by using a version script.
|
||||||
|
|||||||
@@ -34,8 +34,6 @@ outputs:
|
|||||||
publishedPackages:
|
publishedPackages:
|
||||||
description: >
|
description: >
|
||||||
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"}]`
|
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"}]`
|
||||||
hasChangesets:
|
|
||||||
description: A boolean about whether there were changesets. Useful if you want to create your own publishing functionality.
|
|
||||||
branding:
|
branding:
|
||||||
icon: "package"
|
icon: "package"
|
||||||
color: "blue"
|
color: "blue"
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@changesets/action",
|
"name": "@changesets/action",
|
||||||
"version": "1.2.2",
|
"version": "1.2.1",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
+6
-6
@@ -14,12 +14,6 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const inputCwd = core.getInput("cwd");
|
|
||||||
if (inputCwd) {
|
|
||||||
console.log("changing directory to the one given as the input");
|
|
||||||
process.chdir(inputCwd);
|
|
||||||
}
|
|
||||||
|
|
||||||
let setupGitUser = core.getBooleanInput("setupGitUser");
|
let setupGitUser = core.getBooleanInput("setupGitUser");
|
||||||
|
|
||||||
if (setupGitUser) {
|
if (setupGitUser) {
|
||||||
@@ -33,6 +27,12 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
|
|||||||
`machine github.com\nlogin github-actions[bot]\npassword ${githubToken}`
|
`machine github.com\nlogin github-actions[bot]\npassword ${githubToken}`
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const inputCwd = core.getInput("cwd");
|
||||||
|
if (inputCwd) {
|
||||||
|
console.log("changing directory to the one given as the input");
|
||||||
|
process.chdir(inputCwd);
|
||||||
|
}
|
||||||
|
|
||||||
let { changesets } = await readChangesetState();
|
let { changesets } = await readChangesetState();
|
||||||
|
|
||||||
let publishScript = core.getInput("publish");
|
let publishScript = core.getInput("publish");
|
||||||
|
|||||||
Reference in New Issue
Block a user