mirror of
https://github.com/changesets/action
synced 2026-10-26 16:39:56 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
41adcfa1f4 |
@@ -1,8 +0,0 @@
|
|||||||
# 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)
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://unpkg.com/@changesets/config@1.6.2/schema.json",
|
|
||||||
"changelog": [
|
|
||||||
"@changesets/changelog-github",
|
|
||||||
{ "repo": "changesets/action" }
|
|
||||||
],
|
|
||||||
"commit": false,
|
|
||||||
"linked": [],
|
|
||||||
"access": "restricted",
|
|
||||||
"baseBranch": "main",
|
|
||||||
"updateInternalDependencies": "patch",
|
|
||||||
"ignore": []
|
|
||||||
}
|
|
||||||
@@ -9,16 +9,15 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repo
|
- uses: actions/checkout@v2
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Use Node.js 14
|
- name: Use Node.js 12
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: 14.x
|
node-version: 12.x
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install dependencies
|
||||||
run: yarn --frozen-lockfile
|
run: yarn
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: yarn test
|
run: yarn test
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
name: Version or Publish
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
changesets:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout Repo
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Use Node.js 14
|
|
||||||
uses: actions/setup-node@v1
|
|
||||||
with:
|
|
||||||
node-version: 14.x
|
|
||||||
|
|
||||||
- name: Install Dependencies
|
|
||||||
run: yarn --frozen-lockfile
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: yarn build
|
|
||||||
|
|
||||||
- name: Create Release Pull Request or Publish
|
|
||||||
id: changesets
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
version: yarn bump
|
|
||||||
publish: yarn release
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
+1
-3
@@ -1,6 +1,4 @@
|
|||||||
node_modules
|
node_modules
|
||||||
.parcel-cache
|
.parcel-cache
|
||||||
.cache
|
.cache
|
||||||
*.log
|
*.log
|
||||||
|
|
||||||
dist/
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
# @changesets/action
|
|
||||||
|
|
||||||
## 1.2.1
|
|
||||||
|
|
||||||
### Patch Changes
|
|
||||||
|
|
||||||
- [#144](https://github.com/changesets/action/pull/144) [`898d125`](https://github.com/changesets/action/commit/898d125cee6ba00c6a11b6cadca512752c6c910c) Thanks [@Andarist](https://github.com/Andarist)! - Updated all Changesets dependencies. This should fix parsing issues for completely empty summaries that has been fixed in `@changesets/parse@0.3.11`.
|
|
||||||
|
|
||||||
## 1.2.0
|
|
||||||
|
|
||||||
### Minor Changes
|
|
||||||
|
|
||||||
- [#130](https://github.com/changesets/action/pull/130) [`5c0997b`](https://github.com/changesets/action/commit/5c0997b25e175ecf5e1723ba07210bbcea5d92fb) Thanks [@akphi](https://github.com/akphi)! - Added `createGithubReleases` input option (defaults to `true`) to control whether to create Github releases during publish or not.
|
|
||||||
|
|
||||||
* [#134](https://github.com/changesets/action/pull/134) [`1ed9bc2`](https://github.com/changesets/action/commit/1ed9bc24b7a56462c183eb815c8f4bdf0e2e5785) Thanks [@dmregister](https://github.com/dmregister)! - Added `cwd` input option that can be used in projects that are not in the root directory.
|
|
||||||
|
|
||||||
## 1.1.0
|
|
||||||
|
|
||||||
### Minor Changes
|
|
||||||
|
|
||||||
- [#128](https://github.com/changesets/action/pull/128) [`1937303`](https://github.com/changesets/action/commit/19373036c4bad4b0183344b6f2623a3b0e42da6c) Thanks [@dhruvdutt](https://github.com/dhruvdutt)! - Setup the git user in the local config instead of the global one.
|
|
||||||
|
|
||||||
* [#131](https://github.com/changesets/action/pull/131) [`d3db9ec`](https://github.com/changesets/action/commit/d3db9eceaf41d42c56d5370d504c86851627188f) Thanks [@jacklesliewise](https://github.com/jacklesliewise)! - Added `setupGitUser` option to enable or disable setting up a default git user
|
|
||||||
|
|
||||||
## 1.0.0
|
|
||||||
|
|
||||||
### Major Changes
|
|
||||||
|
|
||||||
- [#118](https://github.com/changesets/action/pull/118) [`05c863d`](https://github.com/changesets/action/commit/05c863d3f980125585016a593b5cb45b27d19c2c) Thanks [@Andarist](https://github.com/Andarist)! - From now on this action will be released using the Changesets-based workflow (using itself). Thanks to that we'll have a good release history. The users will be able to find specific versions of the action and will be able to track changes over time. It also improves the security as the build artifact will always get built in the CI environment, using a frozen lockfile.
|
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
# Changesets Release Action
|
# Changesets Release Action
|
||||||
|
|
||||||
|
> ⚠️ This branch has been frozen and deprecated. Please update your workflow to either use `@v1` or a specific commit SHA that is tagged.
|
||||||
|
|
||||||
This action for [Changesets](https://github.com/atlassian/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 you can either publish the packages to npm manually or setup the action to do it for you.
|
This action for [Changesets](https://github.com/atlassian/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 you can either publish the packages to npm manually or setup the action to do it for you.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
@@ -10,8 +12,6 @@ This action for [Changesets](https://github.com/atlassian/changesets) creates a
|
|||||||
- version - The command to update version, edit CHANGELOG, read and delete changesets. Default to `changeset version` if not provided
|
- version - The command to update version, edit CHANGELOG, read and delete changesets. Default to `changeset version` if not provided
|
||||||
- commit - The commit message to use. Default to `Version Packages`
|
- commit - The commit message to use. Default to `Version Packages`
|
||||||
- title - The pull request title. 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 to `true`
|
|
||||||
- cwd - Changes node's `process.cwd()` if the project is not located on the root. Default to `process.cwd()`
|
|
||||||
|
|
||||||
### Outputs
|
### Outputs
|
||||||
|
|
||||||
@@ -32,21 +32,19 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
name: Release
|
name: Release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repo
|
- name: Checkout Repo
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@master
|
||||||
with:
|
with:
|
||||||
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
|
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup Node.js 12.x
|
- name: Setup Node.js 12.x
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@master
|
||||||
with:
|
with:
|
||||||
node-version: 12.x
|
node-version: 12.x
|
||||||
|
|
||||||
@@ -54,7 +52,7 @@ jobs:
|
|||||||
run: yarn
|
run: yarn
|
||||||
|
|
||||||
- name: Create Release Pull Request
|
- name: Create Release Pull Request
|
||||||
uses: changesets/action@v1
|
uses: changesets/action@master
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
```
|
```
|
||||||
@@ -71,21 +69,19 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
name: Release
|
name: Release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repo
|
- name: Checkout Repo
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@master
|
||||||
with:
|
with:
|
||||||
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
|
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup Node.js 12.x
|
- name: Setup Node.js 12.x
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@master
|
||||||
with:
|
with:
|
||||||
node-version: 12.x
|
node-version: 12.x
|
||||||
|
|
||||||
@@ -94,7 +90,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Create Release Pull Request or Publish to npm
|
- name: Create Release Pull Request or Publish to npm
|
||||||
id: changesets
|
id: changesets
|
||||||
uses: changesets/action@v1
|
uses: changesets/action@master
|
||||||
with:
|
with:
|
||||||
# This expects you to have a script called release which does a build for your packages and calls changeset publish
|
# This expects you to have a script called release which does a build for your packages and calls changeset publish
|
||||||
publish: yarn release
|
publish: yarn release
|
||||||
@@ -142,20 +138,18 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
name: Release
|
name: Release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repo
|
- name: Checkout Repo
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@master
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup Node.js 12.x
|
- name: Setup Node.js 12.x
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@master
|
||||||
with:
|
with:
|
||||||
node-version: 12.x
|
node-version: 12.x
|
||||||
|
|
||||||
@@ -163,7 +157,7 @@ jobs:
|
|||||||
run: yarn
|
run: yarn
|
||||||
|
|
||||||
- name: Create Release Pull Request
|
- name: Create Release Pull Request
|
||||||
uses: changesets/action@v1
|
uses: changesets/action@master
|
||||||
with:
|
with:
|
||||||
# this expects you to have a npm script called version that runs some logic and then calls `changeset version`.
|
# this expects you to have a npm script called version that runs some logic and then calls `changeset version`.
|
||||||
version: yarn version
|
version: yarn version
|
||||||
@@ -176,7 +170,7 @@ jobs:
|
|||||||
If you are using [Yarn Plug'n'Play](https://yarnpkg.com/features/pnp), you should use a custom `version` command so that the action can resolve the `changeset` CLI:
|
If you are using [Yarn Plug'n'Play](https://yarnpkg.com/features/pnp), you should use a custom `version` command so that the action can resolve the `changeset` CLI:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: changesets/action@v1
|
- uses: changesets/action@master
|
||||||
with:
|
with:
|
||||||
version: yarn changeset version
|
version: yarn changeset version
|
||||||
...
|
...
|
||||||
|
|||||||
-11
@@ -10,9 +10,6 @@ inputs:
|
|||||||
version:
|
version:
|
||||||
description: "The command to update version, edit CHANGELOG, read and delete changesets. Default to `changeset version` if not provided"
|
description: "The command to update version, edit CHANGELOG, read and delete changesets. Default to `changeset version` if not provided"
|
||||||
required: false
|
required: false
|
||||||
cwd:
|
|
||||||
description: Sets the cwd for the node process. Default to `process.cwd()`
|
|
||||||
required: false
|
|
||||||
commit:
|
commit:
|
||||||
description: |
|
description: |
|
||||||
The commit message. Default to `Version Packages`
|
The commit message. Default to `Version Packages`
|
||||||
@@ -20,14 +17,6 @@ inputs:
|
|||||||
title:
|
title:
|
||||||
description: The pull request title. Default to `Version Packages`
|
description: The pull request title. Default to `Version Packages`
|
||||||
required: false
|
required: false
|
||||||
setupGitUser:
|
|
||||||
description: Sets up the git user for commits as `"github-actions[bot]"`. Default to `true`
|
|
||||||
required: false
|
|
||||||
default: true
|
|
||||||
createGithubReleases:
|
|
||||||
description: "A boolean value to indicate whether to create Github releases after `publish` or not"
|
|
||||||
required: false
|
|
||||||
default: true
|
|
||||||
outputs:
|
outputs:
|
||||||
published:
|
published:
|
||||||
description: A boolean value to indicate whether a publishing is happened or not
|
description: A boolean value to indicate whether a publishing is happened or not
|
||||||
|
|||||||
Vendored
+172
-32
File diff suppressed because one or more lines are too long
+12
-14
@@ -1,12 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "@changesets/action",
|
"name": "@changesets/action",
|
||||||
"version": "1.2.1",
|
"version": "0.1.0",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@changesets/changelog-github": "^0.4.2",
|
"@changesets/cli": "^2.9.1",
|
||||||
"@changesets/cli": "^2.20.0",
|
"@changesets/write": "^0.1.3",
|
||||||
"@changesets/write": "^0.1.6",
|
|
||||||
"fixturez": "^1.1.0",
|
"fixturez": "^1.1.0",
|
||||||
"parcel": "^1.12.3",
|
"parcel": "^1.12.3",
|
||||||
"prettier": "^2.0.5",
|
"prettier": "^2.0.5",
|
||||||
@@ -15,21 +14,18 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "parcel build ./src/index.ts --no-source-maps --target=node --bundle-node-modules",
|
"build": "parcel build ./src/index.ts --no-source-maps --target=node --bundle-node-modules",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"test:watch": "yarn test --watch",
|
"test:watch": "yarn test --watch"
|
||||||
"changeset": "changeset",
|
|
||||||
"bump": "node ./scripts/bump.js",
|
|
||||||
"release": "node ./scripts/release.js"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.3.0",
|
"@actions/core": "^1.6.0",
|
||||||
"@actions/exec": "^1.1.0",
|
"@actions/exec": "^1.0.4",
|
||||||
"@actions/github": "^4.0.0",
|
"@actions/github": "^4.0.0",
|
||||||
"@babel/core": "^7.13.10",
|
"@babel/core": "^7.13.10",
|
||||||
"@babel/preset-env": "^7.13.10",
|
"@babel/preset-env": "^7.13.10",
|
||||||
"@babel/preset-typescript": "^7.13.0",
|
"@babel/preset-typescript": "^7.13.0",
|
||||||
"@changesets/pre": "^1.0.9",
|
"@changesets/pre": "^1.0.4",
|
||||||
"@changesets/read": "^0.5.3",
|
"@changesets/read": "^0.4.6",
|
||||||
"@manypkg/get-packages": "^1.1.3",
|
"@manypkg/get-packages": "^1.1.1",
|
||||||
"@types/fs-extra": "^8.0.0",
|
"@types/fs-extra": "^8.0.0",
|
||||||
"@types/jest": "^24.0.18",
|
"@types/jest": "^24.0.18",
|
||||||
"@types/node": "^12.7.1",
|
"@types/node": "^12.7.1",
|
||||||
@@ -46,7 +42,9 @@
|
|||||||
"unified": "^8.3.2"
|
"unified": "^8.3.2"
|
||||||
},
|
},
|
||||||
"husky": {
|
"husky": {
|
||||||
"hooks": {}
|
"hooks": {
|
||||||
|
"pre-commit": "yarn build && git add dist/index.js"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"prettier": {}
|
"prettier": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
const fs = require("fs");
|
|
||||||
const path = require("path");
|
|
||||||
const { exec } = require("@actions/exec");
|
|
||||||
|
|
||||||
process.chdir(path.join(__dirname, ".."));
|
|
||||||
|
|
||||||
(async () => {
|
|
||||||
await exec("changeset", ["version"]);
|
|
||||||
|
|
||||||
const releaseLine = `v${require("../package.json").version.split(".")[0]}`;
|
|
||||||
|
|
||||||
const readmePath = path.join(__dirname, "..", "README.md");
|
|
||||||
const content = fs.readFileSync(readmePath, "utf8");
|
|
||||||
const updatedContent = content.replace(
|
|
||||||
/changesets\/action@[^\s]+/g,
|
|
||||||
`changesets/action@${releaseLine}`
|
|
||||||
);
|
|
||||||
fs.writeFileSync(readmePath, updatedContent);
|
|
||||||
})();
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
const path = require("path");
|
|
||||||
const { exec, getExecOutput } = require("@actions/exec");
|
|
||||||
|
|
||||||
const { version } = require("../package.json");
|
|
||||||
const tag = `v${version}`;
|
|
||||||
const releaseLine = `v${version.split(".")[0]}`;
|
|
||||||
|
|
||||||
process.chdir(path.join(__dirname, ".."));
|
|
||||||
|
|
||||||
(async () => {
|
|
||||||
const { exitCode, stderr } = await getExecOutput(
|
|
||||||
`git`,
|
|
||||||
["ls-remote", "--exit-code", "origin", "--tags", `refs/tags/${tag}`],
|
|
||||||
{
|
|
||||||
ignoreReturnCode: true,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
if (exitCode === 0) {
|
|
||||||
console.log(
|
|
||||||
`Action is not being published because version ${tag} is already published`
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (exitCode !== 2) {
|
|
||||||
throw new Error(`git ls-remote exited with ${exitCode}:\n${stderr}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
await exec("git", ["checkout", "--detach"]);
|
|
||||||
await exec("git", ["add", "--force", "dist"]);
|
|
||||||
await exec("git", ["commit", "-m", tag]);
|
|
||||||
|
|
||||||
await exec("changeset", ["tag"]);
|
|
||||||
|
|
||||||
await exec("git", [
|
|
||||||
"push",
|
|
||||||
"--force",
|
|
||||||
"--follow-tags",
|
|
||||||
"origin",
|
|
||||||
`HEAD:refs/heads/${releaseLine}`,
|
|
||||||
]);
|
|
||||||
})();
|
|
||||||
@@ -15,7 +15,7 @@ Array [
|
|||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|
||||||
- Updated dependencies
|
- Updated dependencies [undefined]
|
||||||
- simple-project-pkg-b@1.1.0
|
- simple-project-pkg-b@1.1.0
|
||||||
|
|
||||||
## simple-project-pkg-b@1.1.0
|
## simple-project-pkg-b@1.1.0
|
||||||
|
|||||||
@@ -4,11 +4,13 @@ import { execWithOutput } from "./utils";
|
|||||||
export const setupUser = async () => {
|
export const setupUser = async () => {
|
||||||
await exec("git", [
|
await exec("git", [
|
||||||
"config",
|
"config",
|
||||||
|
"--global",
|
||||||
"user.name",
|
"user.name",
|
||||||
`"github-actions[bot]"`,
|
`"github-actions[bot]"`,
|
||||||
]);
|
]);
|
||||||
await exec("git", [
|
await exec("git", [
|
||||||
"config",
|
"config",
|
||||||
|
"--global",
|
||||||
"user.email",
|
"user.email",
|
||||||
`"github-actions[bot]@users.noreply.github.com"`,
|
`"github-actions[bot]@users.noreply.github.com"`,
|
||||||
]);
|
]);
|
||||||
|
|||||||
+6
-13
@@ -4,6 +4,10 @@ import * as gitUtils from "./gitUtils";
|
|||||||
import { runPublish, runVersion } from "./run";
|
import { runPublish, runVersion } from "./run";
|
||||||
import readChangesetState from "./readChangesetState";
|
import readChangesetState from "./readChangesetState";
|
||||||
|
|
||||||
|
core.warning(
|
||||||
|
"The workflow file using `changesets/action` is currently using `@master` as the version. This branch has been frozen and deprecated. Please update your workflow to either use `@v1` or a specific commit SHA that is tagged."
|
||||||
|
);
|
||||||
|
|
||||||
const getOptionalInput = (name: string) => core.getInput(name) || undefined;
|
const getOptionalInput = (name: string) => core.getInput(name) || undefined;
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
@@ -14,12 +18,8 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let setupGitUser = core.getBooleanInput("setupGitUser");
|
console.log("setting git user");
|
||||||
|
await gitUtils.setupUser();
|
||||||
if (setupGitUser) {
|
|
||||||
console.log("setting git user");
|
|
||||||
await gitUtils.setupUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("setting GitHub credentials");
|
console.log("setting GitHub credentials");
|
||||||
await fs.writeFile(
|
await fs.writeFile(
|
||||||
@@ -27,12 +27,6 @@ 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");
|
||||||
@@ -84,7 +78,6 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
|
|||||||
const result = await runPublish({
|
const result = await runPublish({
|
||||||
script: publishScript,
|
script: publishScript,
|
||||||
githubToken,
|
githubToken,
|
||||||
createGithubReleases: core.getBooleanInput("createGithubReleases"),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result.published) {
|
if (result.published) {
|
||||||
|
|||||||
+12
-18
@@ -51,7 +51,6 @@ const createRelease = async (
|
|||||||
type PublishOptions = {
|
type PublishOptions = {
|
||||||
script: string;
|
script: string;
|
||||||
githubToken: string;
|
githubToken: string;
|
||||||
createGithubReleases: boolean;
|
|
||||||
cwd?: string;
|
cwd?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -69,7 +68,6 @@ type PublishResult =
|
|||||||
export async function runPublish({
|
export async function runPublish({
|
||||||
script,
|
script,
|
||||||
githubToken,
|
githubToken,
|
||||||
createGithubReleases,
|
|
||||||
cwd = process.cwd(),
|
cwd = process.cwd(),
|
||||||
}: PublishOptions): Promise<PublishResult> {
|
}: PublishOptions): Promise<PublishResult> {
|
||||||
let octokit = github.getOctokit(githubToken);
|
let octokit = github.getOctokit(githubToken);
|
||||||
@@ -106,16 +104,14 @@ export async function runPublish({
|
|||||||
releasedPackages.push(pkg);
|
releasedPackages.push(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (createGithubReleases) {
|
await Promise.all(
|
||||||
await Promise.all(
|
releasedPackages.map((pkg) =>
|
||||||
releasedPackages.map((pkg) =>
|
createRelease(octokit, {
|
||||||
createRelease(octokit, {
|
pkg,
|
||||||
pkg,
|
tagName: `${pkg.packageJson.name}@${pkg.packageJson.version}`,
|
||||||
tagName: `${pkg.packageJson.name}@${pkg.packageJson.version}`,
|
})
|
||||||
})
|
)
|
||||||
)
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (packages.length === 0) {
|
if (packages.length === 0) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@@ -131,12 +127,10 @@ export async function runPublish({
|
|||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
releasedPackages.push(pkg);
|
releasedPackages.push(pkg);
|
||||||
if (createGithubReleases) {
|
await createRelease(octokit, {
|
||||||
await createRelease(octokit, {
|
pkg,
|
||||||
pkg,
|
tagName: `v${pkg.packageJson.version}`,
|
||||||
tagName: `v${pkg.packageJson.version}`,
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user