lambda-tools
Version:
Scripts for working with AWS Lambda backed microservices
110 lines (104 loc) • 2.57 kB
YAML
version: 2
workflows:
version: 2
install-test-publish:
jobs:
- install-dependencies:
filters:
tags:
only: /.*/
- test:
filters:
tags:
only: /.*/
requires:
- install-dependencies
- lint:
filters:
tags:
only: /.*/
requires:
- install-dependencies
- approve-publish-npm:
type: approval
filters:
tags:
only: /v[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
requires:
- test
- lint
- publish-npm:
filters:
tags:
only: /v[0-9]+(\.[0-9]+)*/
branches:
ignore: /.*/
requires:
- approve-publish-npm
defaults:
docker:
working_directory: ~/builds
docker:
- image: cimg/node:18.0
jobs:
install-dependencies:
<<:
steps:
- checkout
- restore_cache:
keys:
- dependencies-cache-{{ checksum "yarn.lock" }}
- dependencies-cache-
- run:
name: Install yarn
command: >
sudo apt-get install apt-transport-https &&
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - &&
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list &&
sudo apt-get update &&
sudo apt-get install --no-install-recommends yarn
- run:
name: Install dependencies
command: yarn
- save_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- persist_to_workspace:
root: .
paths: node_modules
test:
<<:
steps:
- checkout
- attach_workspace:
at: ~/builds
- run:
name: Run tests
command:
npm test
lint:
<<:
steps:
- checkout
- attach_workspace:
at: ~/builds
- run:
name: Run linter
command:
npm run lint
publish-npm:
<<:
steps:
- checkout
- attach_workspace:
at: ~/builds
- run:
name: Authenticate with registry
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/builds/.npmrc
- run:
name: Publish package
command:
npm publish