Skip to content

Commit 4942af6

Browse files
authored
improv(ci): Moved the secrets expanded in the run block to env variables (#4370)
1 parent 402f4ce commit 4942af6

File tree

6 files changed

+22
-77
lines changed

6 files changed

+22
-77
lines changed

.github/workflows/bootstrap_region.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,6 @@ jobs:
9999
run: go install github.com/aws-powertools/actions/layer-balancer/cmd/balance@29979bc5339bf54f76a11ac36ff67701986bb0f0
100100
- id: run-balance
101101
name: Run Balance
102-
run: balance -read-region us-east-1 -write-region ${{ inputs.region }} -write-role ${{ secrets.BALANCE_ROLE_ARN }} -layer-name AWSLambdaPowertoolsTypeScriptV2 -dry-run=false
102+
env:
103+
BALANCE_ROLE_ARN: ${{ secrets.BALANCE_ROLE_ARN }}
104+
run: balance -read-region us-east-1 -write-region ${{ inputs.region }} -write-role $BALANCE_ROLE_ARN -layer-name AWSLambdaPowertoolsTypeScriptV2 -dry-run=false

.github/workflows/dispatch_analytics.yml

Lines changed: 0 additions & 66 deletions
This file was deleted.

.github/workflows/layer_balance.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ jobs:
4040
contents: read
4141
id-token: write
4242
environment: layer-${{ inputs.environment }}
43+
env:
44+
BALANCE_ROLE_ARN: ${{ secrets.BALANCE_ROLE_ARN }}
4345
steps:
4446
- id: credentials
4547
name: AWS Credentials
@@ -62,8 +64,8 @@ jobs:
6264
- id: run-balance-new-region
6365
name: Run Balance
6466
if: ${{ inputs.start_at == '' }}
65-
run: balance -read-region us-east-1 -write-region ${{ inputs.region }} -write-role ${{ secrets.BALANCE_ROLE_ARN }} -layer-name AWSLambdaPowertoolsTypeScriptV2 -dry-run=false
67+
run: balance -read-region us-east-1 -write-region ${{ inputs.region }} -write-role $BALANCE_ROLE_ARN -layer-name AWSLambdaPowertoolsTypeScriptV2 -dry-run=false
6668
- id: run-balance-existing
6769
name: Run Balance (Existing Region)
6870
if: ${{ inputs.start_at != '' }}
69-
run: balance -read-region us-east-1 -start-at ${{ inputs.start_at }} -write-region ${{ inputs.region }} -write-role ${{ secrets.BALANCE_ROLE_ARN }} -layer-name AWSLambdaPowertoolsTypeScriptV2 -dry-run=false
71+
run: balance -read-region us-east-1 -start-at ${{ inputs.start_at }} -write-region ${{ inputs.region }} -write-role $BALANCE_ROLE_ARN -layer-name AWSLambdaPowertoolsTypeScriptV2 -dry-run=false

.github/workflows/make-release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ jobs:
5353
node-version: "22"
5454
cache: "npm"
5555
- name: Setup auth tokens
56+
env:
57+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
5658
run: |
57-
npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"
59+
npm set "//registry.npmjs.org/:_authToken=$NPM_TOKEN"
5860
- name: Setup dependencies
5961
uses: aws-powertools/actions/.github/actions/cached-node-modules@29979bc5339bf54f76a11ac36ff67701986bb0f0
6062
- name: Publish to npm

.github/workflows/publish-package.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ jobs:
4444
node-version: "22"
4545
cache: "npm"
4646
- name: Setup auth tokens
47+
env:
48+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4749
run: |
48-
npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"
50+
npm set "//registry.npmjs.org/:_authToken=$NPM_TOKEN"
4951
- name: Setup dependencies
5052
uses: aws-powertools/actions/.github/actions/cached-node-modules@29979bc5339bf54f76a11ac36ff67701986bb0f0
5153
- name: Publish to npm

.github/workflows/reusable_publish_docs.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,22 +97,25 @@ jobs:
9797
env:
9898
VERSION: ${{ inputs.version }}
9999
ALIAS: ${{ inputs.alias }}
100+
AWS_DOCS_BUCKET: ${{ secrets.AWS_DOCS_BUCKET }}
100101
run: |
101102
aws s3 sync \
102103
site/ \
103-
s3://${{ secrets.AWS_DOCS_BUCKET }}/lambda-typescript/${{ env.VERSION }}/
104+
s3://$AWS_DOCS_BUCKET/lambda-typescript/$VERSION/
104105
- name: Deploy Docs (Alias)
105106
env:
106107
VERSION: ${{ inputs.version }}
107108
ALIAS: ${{ inputs.alias }}
109+
AWS_DOCS_BUCKET: ${{ secrets.AWS_DOCS_BUCKET }}
108110
run: |
109111
aws s3 sync \
110112
site/ \
111-
s3://${{ secrets.AWS_DOCS_BUCKET }}/lambda-typescript/${{ env.ALIAS }}/
113+
s3://$AWS_DOCS_BUCKET/lambda-typescript/$ALIAS/
112114
- name: Deploy Docs (Version JSON)
113115
env:
114116
VERSION: ${{ inputs.version }}
115117
ALIAS: ${{ inputs.alias }}
118+
AWS_DOCS_BUCKET: ${{ secrets.AWS_DOCS_BUCKET }}
116119
# We originally used "mike" from PyPi to manage versions for us, but since we moved to S3, we can't use it to manage versions any more.
117120
# Instead, we're using some shell script that manages the versions.
118121
#
@@ -127,10 +130,10 @@ jobs:
127130
# 4. Once done, we'll upload it back to S3.
128131
run: |
129132
aws s3 cp \
130-
s3://${{ secrets.AWS_DOCS_BUCKET }}/lambda-typescript/versions.json \
133+
s3://$AWS_DOCS_BUCKET/lambda-typescript/versions.json \
131134
versions_old.json
132-
jq 'del(.[].aliases[] | select(. == "${{ env.ALIAS }}"))' < versions_old.json > versions_proc.json
133-
jq '. as $o | [{"title": "${{ env.VERSION }}", "version": "${{ env.VERSION }}", "aliases": ["${{ env.ALIAS }}"] }] as $n | $n | if .[0].title | test("[a-z]+") or any($o[].title == $n[0].title;.) then [($o | .[] | select(.title == $n[0].title).aliases += $n[0].aliases | . )] else $n + $o end' < versions_proc.json > versions.json
135+
jq 'del(.[].aliases[] | select(. == "$ALIAS"))' < versions_old.json > versions_proc.json
136+
jq '. as $o | [{"title": "$VERSION", "version": "$VERSION", "aliases": ["$ALIAS"] }] as $n | $n | if .[0].title | test("[a-z]+") or any($o[].title == $n[0].title;.) then [($o | .[] | select(.title == $n[0].title).aliases += $n[0].aliases | . )] else $n + $o end' < versions_proc.json > versions.json
134137
aws s3 cp \
135138
versions.json \
136-
s3://${{ secrets.AWS_DOCS_BUCKET }}/lambda-typescript/versions.json
139+
s3://$AWS_DOCS_BUCKET/lambda-typescript/versions.json

0 commit comments

Comments
 (0)