serverless-git-version-compare

1.0.1 • Public • Published

serverless-git-version-compare

serverless npm Secured by: Jit code style: prettier

Description

serverless-git-version-compare is a plugin for the Serverless Framework that compares the local and deployed AWS serverless stack versions. It helps ensure that the same version is not deployed multiple times, preventing unnecessary deployments.

How it works

Upon running sls deploy, the plugin will automatically compare the local and deployed versions by using the HEAD commit hash and comparing it to the stack tag. If the versions are the same, the deployment will be skipped. Otherwise, the stack tag will be updated with the new commit. The tag is added to every resource deployed as part of the stack.

For local deployments, if the working directory is not clean, the deployment will continue regardless of the version comparison. To change this default behavior, see the configuration section below.

Installation

To install the plugin, add it to your project using npm:

npm install serverless-git-version-compare --save-dev

Then, add the plugin to your serverless.yml file:

plugins:
  - serverless-git-version-compare

Configuration

You can configure the plugin in your serverless.yml file under the custom section:

custom:
  gitVersionCompare:
    enabled: true
    alwaysDeployDirty: true
  • enabled (default: true): Enables or disables the plugin.
  • alwaysDeployDirty (default: true): Whether to ignore version comparison if the working directory is not clean.

CLI Options

The plugin provides an optional CLI option:

--force: Forces the deployment to continue regardless of the commit hash.

Plugin Commands

The plugin provides a command to fetch the current deployed version:

sls get-deployed-commit

License

This project is licensed under the MIT License - see the LICENSE file for details

Package Sidebar

Install

npm i serverless-git-version-compare

Weekly Downloads

12

Version

1.0.1

License

MIT

Unpacked Size

10 kB

Total Files

4

Last publish

Collaborators

  • yonatangreenfeld