Publish Package #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Package | |
# This workflow publishes a single package to NPM | |
on: | |
workflow_dispatch: | |
inputs: | |
package: | |
description: 'The package to publish' | |
type: choice | |
required: true | |
options: | |
- packages/batch | |
- packages/commons | |
- packages/idempotency | |
- packages/jmespath | |
- packages/logger | |
- packages/metrics | |
- packages/tracer | |
- packages/parameters | |
- packages/parser | |
permissions: | |
contents: read | |
jobs: | |
run-unit-tests: | |
uses: ./.github/workflows/reusable-run-linting-check-and-unit-tests.yml | |
publish-npm: | |
needs: run-unit-tests | |
permissions: | |
id-token: write | |
environment: Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 | |
with: | |
ref: ${{ github.sha }} | |
- name: Setup NodeJS | |
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 | |
with: | |
node-version: "20" | |
cache: "npm" | |
- name: Setup auth tokens | |
run: | | |
npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" | |
- name: Setup dependencies | |
uses: aws-powertools/actions/.github/actions/cached-node-modules@d406bac5563f1d8c793519a3eedfe620f6a14872 | |
- name: Publish to npm | |
run: | | |
NPM_CONFIG_PROVENANCE=true npx lerna publish from-package --force-publish ${{ github.event.input.package }} --git-head ${{ github.sha }} --yes |