Skip to content

.github/workflows/npm.yml #212

.github/workflows/npm.yml

.github/workflows/npm.yml #212

Workflow file for this run

on:
pull_request:
push:
branches:
- main
tags:
- "v*"
permissions:
id-token: write # Required for OIDC NPMJS publishing
contents: write
jobs:
build:
runs-on: ubuntu-latest
env:
# The AWS JS SDK only respects AWS_REGION, not AWS_DEFAULT_REGION
# See https://github.com/aws/aws-sdk-js/issues/2929
AWS_DEFAULT_REGION: us-east-1
AWS_REGION: us-east-1
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: APT Install
run: |
sudo apt-get install \
jq \
python3-pip \
python3-setuptools
- name: PIP Install
run: |
pip3 install awscli --upgrade --user
- name: Setup NodeJS
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
registry-url: "https://registry.npmjs.org"
- name: NPM Install
run: |
npm install --global npm@latest
npm ci
- name: Build and Test
run: npm run build-and-test
- name: Release
if: startsWith(github.ref, 'refs/tags/v')
run: npm run release
- name: GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
uses: ncipollo/release-action@v1
with:
artifacts: dist/layer.zip
token: ${{ secrets.GITHUB_TOKEN }}
- name: NPM Publish
if: startsWith(github.ref, 'refs/tags/v')
run: |
npm --no-git-tag-version version "$(git describe --tags --abbrev=0)"
npm publish