-
Notifications
You must be signed in to change notification settings - Fork 91
53 lines (51 loc) · 1.8 KB
/
release-npm-ssdk-libs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: release-npm-ssdk-libs
on:
workflow_dispatch: # on button click
jobs:
release:
name: Release to SSDK lib packages to NPM
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: "yarn"
- name: Install dependencies
run: yarn install
- name: Configure AWS Credentials
id: credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-west-2
role-to-assume: ${{ secrets.ROLE_TO_ASSUME }}
role-session-name: SmithyTypeScriptGitHubRelease
audience: sts.amazonaws.com
- name: Fetch NPM token
id: token
run: |
aws configure --profile token set role_arn ${{ secrets.TOKEN_ROLE }}
aws configure --profile token set credential_source Environment
npm_token=$(aws secretsmanager get-secret-value --region us-west-2 --secret-id=SMITHY_PUBLISH_npmToken --query SecretString --output text --profile token)
echo "::add-mask::$npm_token"
echo "NPM_TOKEN=$npm_token" >> $GITHUB_ENV
- name: Stage Release
id: stage
if: steps.token.outcome == 'success'
run: |
yarn stage-release --concurrency=1
- name: Release
id: release
uses: changesets/action@v1
if: steps.stage.outcome == 'success'
with:
publish: yarn release
env:
NPM_TOKEN: ${{ env.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Failure Nofitication
if: ${{ failure() }}
run: aws cloudwatch put-metric-data --namespace SmithyTypeScriptPublish --metric-name NpmPackagePublishFailure --value 1