@mob-sakai/semantic-release-git-snapshot v2.0.1
@mob-sakai/semantic-release-git-snapshot
A plugin for semantic-release plugin to take a snapshot of package contents and push it to the project's git repository
Step | Description |
---|---|
verifyConditions | Verify the access to the remote Git repository, the option configuration. |
publish | Create a release commit, including configurable directory. |
Changelog
See changelog.
Install
$ npm install --save-dev @mob-sakai/semantic-release-git-snapshot
Usage
The plugin can be configured in the semantic-release configuration file:
{
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/npm",
{
"pkgRoot": "dest"
}
]
"@semantic-release/git",
[
"@mob-sakai/semantic-release-git-snapshot",
{
"snapshotBranch": "snapshot",
"snapshotTagFormat": "${version}"
}
]
]
}
With this example, for each release a release commit will be pushed to the remote Git repository with:
- a message formatted like
1.0.0
- all files in
dest
are packed, and unpacked contents are committed tosnapshot
branch
Configuration
Git authentication
The Git user associated with the Git credentials has to be able to push commit to the release branch.
When configuring branches permission on a Git hosting service (e.g. GitHub protected branches, GitLab protected branches or Bitbucket branch permissions) it might be necessary to create a specific configuration in order to allow the semantic-release user to bypass global restrictions. For example on GitHub you can uncheck "Include administrators" and configure semantic-release to use an administrator user, so the plugin can push the release commit without requiring status checks and pull request reviews.
Environment variables
Variable | Description | Default |
---|---|---|
GIT_AUTHOR_NAME | The author name associated with the release commit. See Git environment variables. | @semantic-release-bot. |
GIT_AUTHOR_EMAIL | The author email associated with the release commit. See Git environment variables. | @semantic-release-bot email address. |
GIT_COMMITTER_NAME | The committer name associated with the release commit. See Git environment variables. | @semantic-release-bot. |
GIT_COMMITTER_EMAIL | The committer email associated with the release commit. See Git environment variables. | @semantic-release-bot email address. |
Options
Options | Description | Default |
---|---|---|
snapshotBranch | The branch name for split to. See snapshotBranch. | snapshot |
snapshotTagFormat | The message for the release commit. See snapshotTagFormat. | ${version} |
snapshotBranch
The branch name for split to.
If the remote branch does not exist, an orphan branch is created.
snapshotTagFormat
The tag name is generated with Lodash template and will be compiled with the version
variable.
Note: The snapshotTagFormat must contain the version variable exactly once and compile to a valid Git reference.
License
MIT