Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement flag "skip-push", deprecate flag "push" #143

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,27 @@ The tag is not added to the git repository (optional). Example:
```

#### **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
- name: 'Automated Version Bump'
uses: 'phips28/gh-action-bump-version@master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
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:**
Param to parse the location of the desired package.json (optional). Example:
Expand Down Expand Up @@ -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]'
```

#### **push:**
Set false you want to avoid pushing the new version tag/package.json. Example:
#### [DEPRECATED] **push:**
**DEPRECATED** Set false you want to avoid pushing the new version tag/package.json. Example:
```yaml
- name: 'Automated Version Bump'
uses: 'phips28/gh-action-bump-version@master'
Expand Down
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ inputs:
description: 'Avoid to add a commit after the version is bumped'
default: '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:
description: 'Custom dir to the package'
default: ''
Expand All @@ -55,7 +59,7 @@ inputs:
default: ''
required: false
push:
description: 'Set to false to skip pushing the new tag'
description: '[DEPRECATED] Set to false to skip pushing the new tag'
default: 'true'
required: false
outputs:
Expand Down
10 changes: 7 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
if (process.env['INPUT_SKIP-TAG'] !== 'true') {
await runInWorkspace('git', ['tag', newVersion]);
await runInWorkspace('git', ['push', remoteRepo, '--follow-tags']);
await runInWorkspace('git', ['push', remoteRepo, '--tags']);
if (process.env['INPUT_SKIP-PUSH'] !== 'true') {
await runInWorkspace('git', ['push', remoteRepo, '--follow-tags']);
await runInWorkspace('git', ['push', remoteRepo, '--tags']);
}
} else {
await runInWorkspace('git', ['push', remoteRepo]);
if (process.env['INPUT_SKIP-PUSH'] !== 'true') {
await runInWorkspace('git', ['push', remoteRepo]);
}
}
} catch (e) {
logError(e);
Expand Down