@mob-sakai/semantic-release-git-snapshot
A plugin for semantic-release to take a snapshot of the directory and creates/updates another branch, like git subtree split --squash
.
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 @mob-sakai/semantic-release-git-snapshot -D
Usage
The plugin can be configured in the semantic-release configuration file:
{
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/git",
["@mob-sakai/semantic-release-git-snapshot", {
"snapshotPrefix": "./dist",
"snapshotBranch": "snapshot",
"snapshotTagFormat": "snapshot for ${version}"
}]
]
}
With this example, for each release a release commit will be pushed to the remote Git repository with:
- a message formatted like
snapshot for <version>
- all files in the
dist
directory are committed onsnapshot
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 |
---|---|---|
snapshotPrefix |
The directory path to split out. See snapshotPrefix. | . |
snapshotBranch |
The branch name for split to. See snapshotBranch. | upm |
snapshotTagFormat |
The message for the release commit. See snapshotTagFormat. | ${version} |
snapshotPrefix
The relative directory path to split out.
The files that match patterns contained in .gitignore
are not copied.
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