# @mob-sakai/semantic-release-git-snapshot

> A semantic-release plugin to commit release assets to the project's git repository

Latest version **2.0.1** (published 2019-10-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install @mob-sakai/semantic-release-git-snapshot
pnpm add @mob-sakai/semantic-release-git-snapshot
yarn add @mob-sakai/semantic-release-git-snapshot
bun add @mob-sakai/semantic-release-git-snapshot
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2019-10-30 |
| First published | 2019-10-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.15 |
| Dependencies | 6 |
| Unpacked size | 21.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | mob-sakai |
| Maintainers | mob-sakai |
| Keywords | changelog, commit, conventional-changelog, conventional-commits, git, release, semantic-release, version |

## Links

- npm: https://www.npmjs.com/package/@mob-sakai/semantic-release-git-snapshot
- Repository: https://github.com/mob-sakai/semantic-release-git-snapshot
- Issues: https://github.com/mob-sakai/semantic-release-git-snapshot/issues
- npm.io page: https://npm.io/package/@mob-sakai/semantic-release-git-snapshot

## Dependencies (6)

- [debug](https://npm.io/package/debug.md) ^4.0.0
- [execa](https://npm.io/package/execa.md) ^3.2.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [git-snapshot](https://npm.io/package/git-snapshot.md) ^2.2.0
- [aggregate-error](https://npm.io/package/aggregate-error.md) ^3.0.0
- [@semantic-release/error](https://npm.io/package/@semantic-release/error.md) ^2.1.0

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [@luma.gl/experimental](https://npm.io/package/@luma.gl/experimental.md) — 77.1K weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads

## Recent versions

- 2.0.1 (latest) — 2019-10-30
- 3.0.0-beta.1 (beta) — 2019-10-31
- 2.0.0 — 2019-10-30
- 1.2.0-beta.3 — 2019-10-30

## README

# @mob-sakai/semantic-release-git-snapshot

A plugin for [**semantic-release**](https://github.com/semantic-release/semantic-release) to take a snapshot of the directory and creates/updates another branch, like `git subtree split --squash`.

[![npm](https://img.shields.io/npm/v/@mob-sakai/semantic-release-git-snapshot)](https://www.npmjs.com/package/@mob-sakai/semantic-release-git-snapshot)
[![npm (beta)](https://img.shields.io/npm/v/@mob-sakai/semantic-release-git-snapshot/beta)](https://www.npmjs.com/package/@mob-sakai/semantic-release-git-snapshot/v/beta)
![license](https://img.shields.io/npm/l/@mob-sakai/semantic-release-git-snapshot)
![downloads](https://img.shields.io/npm/dy/@mob-sakai/semantic-release-git-snapshot)
![release](https://github.com/mob-sakai/semantic-release-git-snapshot/workflows/release/badge.svg)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)

| Step               | Description                                                                                 |
|--------------------|---------------------------------------------------------------------------------------------|
| `verifyConditions` | Verify the access to the remote Git repository, the option [configuration](#configuration). |
| `publish`          | Create a release commit, including configurable directory.                                  |

## Changelog

See [changelog](https://github.com/mob-sakai/semantic-release-git-snapshot/blob/master/CHANGELOG.md).

## Install

```bash
$ npm install @mob-sakai/semantic-release-git-snapshot -D
```

## Usage

The plugin can be configured in the [**semantic-release** configuration file](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#configuration):

```json
{
  "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 on `snapshot` branch

## Configuration

### Git authentication

The Git user associated with the [Git credentials](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/ci-configuration.md#authentication) has to be able to push commit to the [release branch](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#branch).

When configuring branches permission on a Git hosting service (e.g. [GitHub protected branches](https://help.github.com/articles/about-protected-branches), [GitLab protected branches](https://docs.gitlab.com/ee/user/project/protected_branches.html) or [Bitbucket branch permissions](https://confluence.atlassian.com/bitbucket/branch-permissions-385912271.html)) 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](https://help.github.com/articles/about-required-status-checks) and [pull request reviews](https://help.github.com/articles/about-required-reviews-for-pull-requests).

### Environment variables

| Variable              | Description                                                                                                                                                              | Default                              |
|-----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------|
| `GIT_AUTHOR_NAME`     | The author name associated with the release commit. See [Git environment variables](https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables#_committing).     | @semantic-release-bot.               |
| `GIT_AUTHOR_EMAIL`    | The author email associated with the release commit. See [Git environment variables](https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables#_committing).    | @semantic-release-bot email address. |
| `GIT_COMMITTER_NAME`  | The committer name associated with the release commit. See [Git environment variables](https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables#_committing).  | @semantic-release-bot.               |
| `GIT_COMMITTER_EMAIL` | The committer email associated with the release commit. See [Git environment variables](https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables#_committing). | @semantic-release-bot email address. |

### Options

| Options    | Description                                                      | Default      |
|------------|------------------------------------------------------------------|--------------|
| `snapshotPrefix`   | The directory path to split out. See [snapshotPrefix](#snapshotPrefix).          | `.`          |
| `snapshotBranch`   | The branch name for split to. See [snapshotBranch](#snapshotBranch).             | `upm`        |
| `snapshotTagFormat`| The message for the release commit. See [snapshotTagFormat](#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](https://lodash.com/docs#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](https://git-scm.com/docs/git-check-ref-format#_description).

## License

MIT

## See Also

- GitHub page : https://github.com/mob-sakai/semantic-release-git-snapshot
- npm page : https://www.npmjs.com/package/@mob-sakai/semantic-release-git-snapshot
- git-snapshot : https://www.npmjs.com/package/git-snapshot

[![become_a_sponsor_on_github](https://user-images.githubusercontent.com/12690315/66942881-03686280-f085-11e9-9586-fc0b6011029f.png)](https://github.com/users/mob-sakai/sponsorship)

---
_Source: https://npm.io/package/@mob-sakai/semantic-release-git-snapshot · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
