Merge pull request #143 from rosshamish/user/rosshamish/skip-push-no-tests
Implement flag "skip-push", deprecate flag "push"
This commit is contained in:
commit
53dc688c78
17
README.md
17
README.md
|
@ -96,7 +96,7 @@ The tag is not added to the git repository (optional). Example:
|
||||||
```
|
```
|
||||||
|
|
||||||
#### **skip-commit:**
|
#### **skip-commit:**
|
||||||
No commit is made after the version is bumped (optional). Example:
|
No commit is made after the version is bumped (optional). Must be used in combination with `skip-tag`, since if there's no commit, there's nothing to tag. Example:
|
||||||
```yaml
|
```yaml
|
||||||
- name: 'Automated Version Bump'
|
- name: 'Automated Version Bump'
|
||||||
uses: 'phips28/gh-action-bump-version@master'
|
uses: 'phips28/gh-action-bump-version@master'
|
||||||
|
@ -104,8 +104,19 @@ No commit is made after the version is bumped (optional). Example:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
skip-commit: 'true'
|
skip-commit: 'true'
|
||||||
|
skip-tag: 'true'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### **skip-push:**
|
||||||
|
If true, skip pushing any commits or tags created after the version bump (optional). Example:
|
||||||
|
```yaml
|
||||||
|
- name: 'Automated Version Bump'
|
||||||
|
uses: 'phips28/gh-action-bump-version@master'
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
skip-push: 'true'
|
||||||
|
```
|
||||||
|
|
||||||
#### **PACKAGEJSON_DIR:**
|
#### **PACKAGEJSON_DIR:**
|
||||||
Param to parse the location of the desired package.json (optional). Example:
|
Param to parse the location of the desired package.json (optional). Example:
|
||||||
|
@ -139,8 +150,8 @@ Set a custom commit message for version bump commit. Useful for skipping additio
|
||||||
commit-message: 'CI: bumps version to {{version}} [skip ci]'
|
commit-message: 'CI: bumps version to {{version}} [skip ci]'
|
||||||
```
|
```
|
||||||
|
|
||||||
#### **push:**
|
#### [DEPRECATED] **push:**
|
||||||
Set false you want to avoid pushing the new version tag/package.json. Example:
|
**DEPRECATED** Set false you want to avoid pushing the new version tag/package.json. Example:
|
||||||
```yaml
|
```yaml
|
||||||
- name: 'Automated Version Bump'
|
- name: 'Automated Version Bump'
|
||||||
uses: 'phips28/gh-action-bump-version@master'
|
uses: 'phips28/gh-action-bump-version@master'
|
||||||
|
|
|
@ -34,6 +34,10 @@ inputs:
|
||||||
description: 'Avoid to add a commit after the version is bumped'
|
description: 'Avoid to add a commit after the version is bumped'
|
||||||
default: 'false'
|
default: 'false'
|
||||||
required: false
|
required: false
|
||||||
|
skip-push:
|
||||||
|
description: 'If true, skip pushing any commits or tags created after the version bump'
|
||||||
|
default: false
|
||||||
|
required: false
|
||||||
PACKAGEJSON_DIR:
|
PACKAGEJSON_DIR:
|
||||||
description: 'Custom dir to the package'
|
description: 'Custom dir to the package'
|
||||||
default: ''
|
default: ''
|
||||||
|
@ -55,7 +59,7 @@ inputs:
|
||||||
default: ''
|
default: ''
|
||||||
required: false
|
required: false
|
||||||
push:
|
push:
|
||||||
description: 'Set to false to skip pushing the new tag'
|
description: '[DEPRECATED] Set to false to skip pushing the new tag'
|
||||||
default: 'true'
|
default: 'true'
|
||||||
required: false
|
required: false
|
||||||
outputs:
|
outputs:
|
||||||
|
|
10
index.js
10
index.js
|
@ -176,10 +176,14 @@ const workspace = process.env.GITHUB_WORKSPACE;
|
||||||
const remoteRepo = `https://${process.env.GITHUB_ACTOR}:${process.env.GITHUB_TOKEN}@github.com/${process.env.GITHUB_REPOSITORY}.git`;
|
const remoteRepo = `https://${process.env.GITHUB_ACTOR}:${process.env.GITHUB_TOKEN}@github.com/${process.env.GITHUB_REPOSITORY}.git`;
|
||||||
if (process.env['INPUT_SKIP-TAG'] !== 'true') {
|
if (process.env['INPUT_SKIP-TAG'] !== 'true') {
|
||||||
await runInWorkspace('git', ['tag', newVersion]);
|
await runInWorkspace('git', ['tag', newVersion]);
|
||||||
await runInWorkspace('git', ['push', remoteRepo, '--follow-tags']);
|
if (process.env['INPUT_SKIP-PUSH'] !== 'true') {
|
||||||
await runInWorkspace('git', ['push', remoteRepo, '--tags']);
|
await runInWorkspace('git', ['push', remoteRepo, '--follow-tags']);
|
||||||
|
await runInWorkspace('git', ['push', remoteRepo, '--tags']);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
await runInWorkspace('git', ['push', remoteRepo]);
|
if (process.env['INPUT_SKIP-PUSH'] !== 'true') {
|
||||||
|
await runInWorkspace('git', ['push', remoteRepo]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logError(e);
|
logError(e);
|
||||||
|
|
Loading…
Reference in New Issue