Skip to content

Commit 8a85ca2

Browse files
authored
chore(ci): add workflow to publish a single package (#3234)
1 parent e308143 commit 8a85ca2

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/publish-package.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Publish Package
2+
3+
# This workflow publishes a single package to NPM
4+
5+
on:
6+
workflow_dispatch:
7+
inputs:
8+
package:
9+
description: 'The package to publish'
10+
required: true
11+
options:
12+
- packages/batch
13+
- packages/commons
14+
- packages/idempotency
15+
- packages/jmespath
16+
- packages/logger
17+
- packages/metrics
18+
- packages/tracer
19+
- packages/parameters
20+
- packages/parser
21+
22+
permissions:
23+
contents: read
24+
25+
26+
jobs:
27+
run-unit-tests:
28+
uses: ./.github/workflows/reusable-run-linting-check-and-unit-tests.yml
29+
publish-npm:
30+
needs: run-unit-tests
31+
permissions:
32+
id-token: write
33+
environment: Release
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Checkout code
37+
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
38+
with:
39+
ref: ${{ github.sha }}
40+
- name: Setup NodeJS
41+
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
42+
with:
43+
node-version: "20"
44+
cache: "npm"
45+
- name: Setup auth tokens
46+
run: |
47+
npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"
48+
- name: Setup dependencies
49+
uses: aws-powertools/actions/.github/actions/cached-node-modules@d406bac5563f1d8c793519a3eedfe620f6a14872
50+
- name: Publish to npm
51+
run: |
52+
NPM_CONFIG_PROVENANCE=true npx lerna publish from-package --force-publish ${{ github.event.input.package }} --git-head ${{ github.sha }} --yes

0 commit comments

Comments
 (0)