2.0.1 • Published 5 years ago

@mob-sakai/semantic-release-git-snapshot v2.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

@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

npm npm (beta) license downloads release semantic-release

StepDescription
verifyConditionsVerify the access to the remote Git repository, the option configuration.
publishCreate 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 to snapshot 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

VariableDescriptionDefault
GIT_AUTHOR_NAMEThe author name associated with the release commit. See Git environment variables.@semantic-release-bot.
GIT_AUTHOR_EMAILThe author email associated with the release commit. See Git environment variables.@semantic-release-bot email address.
GIT_COMMITTER_NAMEThe committer name associated with the release commit. See Git environment variables.@semantic-release-bot.
GIT_COMMITTER_EMAILThe committer email associated with the release commit. See Git environment variables.@semantic-release-bot email address.

Options

OptionsDescriptionDefault
snapshotBranchThe branch name for split to. See snapshotBranch.snapshot
snapshotTagFormatThe 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

See Also

become_a_sponsor_on_github