This commit is contained in:
Andrea Lamparelli 2022-12-23 19:38:57 +01:00
parent 74703c48f3
commit 8828684a38
6 changed files with 13 additions and 14 deletions

View file

@ -11,9 +11,9 @@ on:
default: patch
type: string
message:
description: 'version commit message to be used'
description: 'bump version commit message'
required: false
default: 'Bumping version %s'
default: 'Bump release version %s'
type: string
jobs:
@ -26,9 +26,8 @@ jobs:
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm version $(semver $npm_package_version -i ${{ inputs.version }}) -m "${{ inputs.message }}"
- run: npm install
- run: npm publish --access public
- run: npm version ${{ inputs.version }} -m "${{ inputs.message }}"
- run: npm install && npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

View file

@ -40,8 +40,8 @@ class GitCLIService {
* Return the git version
* @returns {Promise<string | undefined>}
*/
async version() {
const rawOutput = await this.git().raw("version");
async version(cwd) {
const rawOutput = await this.git(cwd).raw("version");
const match = rawOutput.match(/(\d+\.\d+(\.\d+)?)/);
return match ? match[1] : undefined;
}

4
dist/cli/index.js vendored
View file

@ -198,8 +198,8 @@ class GitCLIService {
* Return the git version
* @returns {Promise<string | undefined>}
*/
async version() {
const rawOutput = await this.git().raw("version");
async version(cwd) {
const rawOutput = await this.git(cwd).raw("version");
const match = rawOutput.match(/(\d+\.\d+(\.\d+)?)/);
return match ? match[1] : undefined;
}

4
dist/gha/index.js vendored
View file

@ -177,8 +177,8 @@ class GitCLIService {
* Return the git version
* @returns {Promise<string | undefined>}
*/
async version() {
const rawOutput = await this.git().raw("version");
async version(cwd) {
const rawOutput = await this.git(cwd).raw("version");
const match = rawOutput.match(/(\d+\.\d+(\.\d+)?)/);
return match ? match[1] : undefined;
}

View file

@ -46,8 +46,8 @@ export default class GitCLIService {
* Return the git version
* @returns {Promise<string | undefined>}
*/
async version(): Promise<string | undefined> {
const rawOutput = await this.git().raw("version");
async version(cwd: string): Promise<string | undefined> {
const rawOutput = await this.git(cwd).raw("version");
const match = rawOutput.match(/(\d+\.\d+(\.\d+)?)/);
return match ? match[1] : undefined;
}

View file

@ -74,7 +74,7 @@ beforeEach(() => {
describe("git cli service", () => {
test("version", async () => {
const result = await git.version();
const result = await git.version(cwd);
const actualVersion = spawnSync("git", ["version"]).stdout.toString();
const match = actualVersion.match(/(\d+\.\d+(\.\d+)?)/);
if (match) {