Skip to content

Commit 57832d3

Browse files
Update publish-catalogs.yml
1 parent 2770e6d commit 57832d3

1 file changed

Lines changed: 23 additions & 13 deletions

File tree

.github/workflows/publish-catalogs.yml

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -179,25 +179,35 @@ jobs:
179179
include:
180180
- account: 1
181181
role_secret: AWS_ROLE_ARN_1
182+
bucket_secret: AWS_S3_CATALOG_BUCKET_1
183+
bucket_legacy_secret: AWS_S3_CATALOG_BUCKET_LEGACY_1
182184
- account: 2
183185
role_secret: AWS_ROLE_ARN_2
186+
bucket_secret: AWS_S3_CATALOG_BUCKET_2
187+
bucket_legacy_secret: AWS_S3_CATALOG_BUCKET_LEGACY_2
184188
- account: 3
185189
role_secret: AWS_ROLE_ARN_3
190+
bucket_secret: AWS_S3_CATALOG_BUCKET_3
191+
bucket_legacy_secret: AWS_S3_CATALOG_BUCKET_LEGACY_3
186192
env:
187193
AWS_REGION: ${{ secrets.AWS_REGION }}
188-
S3_BUCKET_PRIMARY: ${{ secrets.AWS_S3_CATALOG_BUCKET }}
189-
S3_BUCKET_LEGACY: ${{ secrets.AWS_S3_CATALOG_BUCKET_LEGACY }}
194+
S3_BUCKET_PRIMARY: ${{ secrets[matrix.bucket_secret] }}
195+
S3_BUCKET_LEGACY: ${{ secrets[matrix.bucket_legacy_secret] }}
190196
steps:
191197
- name: Check if account is configured
192198
id: check
193199
env:
194200
ROLE_ARN: ${{ secrets[matrix.role_secret] }}
201+
BUCKET_PRIMARY: ${{ secrets[matrix.bucket_secret] }}
202+
BUCKET_LEGACY: ${{ secrets[matrix.bucket_legacy_secret] }}
195203
run: |
196204
if [ -z "$ROLE_ARN" ]; then
197205
echo "skip=true" >> $GITHUB_OUTPUT
198206
echo "Account ${{ matrix.account }} not configured, skipping"
199207
else
200208
echo "::add-mask::$ROLE_ARN"
209+
[ -n "$BUCKET_PRIMARY" ] && echo "::add-mask::$BUCKET_PRIMARY"
210+
[ -n "$BUCKET_LEGACY" ] && echo "::add-mask::$BUCKET_LEGACY"
201211
echo "skip=false" >> $GITHUB_OUTPUT
202212
echo "role_arn=$ROLE_ARN" >> $GITHUB_OUTPUT
203213
fi
@@ -207,7 +217,7 @@ jobs:
207217
run: |
208218
missing=""
209219
[ -z "${{ env.AWS_REGION }}" ] && missing="$missing AWS_REGION"
210-
[ -z "${{ env.S3_BUCKET_PRIMARY }}" ] && missing="$missing AWS_S3_CATALOG_BUCKET"
220+
[ -z "${{ env.S3_BUCKET_PRIMARY }}" ] && missing="$missing ${{ matrix.bucket_secret }}"
211221
if [ -n "$missing" ]; then
212222
echo "::error::Missing required secrets:$missing"
213223
exit 1
@@ -230,22 +240,22 @@ jobs:
230240
if: steps.check.outputs.skip == 'false' && github.ref == 'refs/heads/develop'
231241
run: |
232242
set -euo pipefail
233-
aws s3 cp analyzers/analyzers-devel.json "s3://${S3_BUCKET_PRIMARY}/latest/json/analyzers-devel.json" --no-progress --content-type "application/json"
234-
aws s3 cp responders/responders-devel.json "s3://${S3_BUCKET_PRIMARY}/latest/json/responders-devel.json" --no-progress --content-type "application/json"
243+
aws s3 cp analyzers/analyzers-devel.json "s3://${S3_BUCKET_PRIMARY}/latest/json/analyzers-devel.json" --only-show-errors --content-type "application/json"
244+
aws s3 cp responders/responders-devel.json "s3://${S3_BUCKET_PRIMARY}/latest/json/responders-devel.json" --only-show-errors --content-type "application/json"
235245
if [ -n "${S3_BUCKET_LEGACY}" ]; then
236-
aws s3 cp analyzers/analyzers-devel.json "s3://${S3_BUCKET_LEGACY}/analyzers-devel.json" --no-progress --content-type "application/json"
237-
aws s3 cp responders/responders-devel.json "s3://${S3_BUCKET_LEGACY}/responders-devel.json" --no-progress --content-type "application/json"
246+
aws s3 cp analyzers/analyzers-devel.json "s3://${S3_BUCKET_LEGACY}/analyzers-devel.json" --only-show-errors --content-type "application/json"
247+
aws s3 cp responders/responders-devel.json "s3://${S3_BUCKET_LEGACY}/responders-devel.json" --only-show-errors --content-type "application/json"
238248
fi
239249
240250
- name: Upload production catalogs to S3
241251
if: steps.check.outputs.skip == 'false' && startsWith(github.ref, 'refs/tags/')
242252
run: |
243253
set -euo pipefail
244-
aws s3 cp analyzers/analyzers.json "s3://${S3_BUCKET_PRIMARY}/latest/json/analyzers.json" --no-progress --content-type "application/json"
245-
aws s3 cp responders/responders.json "s3://${S3_BUCKET_PRIMARY}/latest/json/responders.json" --no-progress --content-type "application/json"
246-
aws s3 cp analyzers/report-templates.zip "s3://${S3_BUCKET_PRIMARY}/latest/zip/report-templates.zip" --no-progress --content-type "application/zip"
254+
aws s3 cp analyzers/analyzers.json "s3://${S3_BUCKET_PRIMARY}/latest/json/analyzers.json" --only-show-errors --content-type "application/json"
255+
aws s3 cp responders/responders.json "s3://${S3_BUCKET_PRIMARY}/latest/json/responders.json" --only-show-errors --content-type "application/json"
256+
aws s3 cp analyzers/report-templates.zip "s3://${S3_BUCKET_PRIMARY}/latest/zip/report-templates.zip" --only-show-errors --content-type "application/zip"
247257
if [ -n "${S3_BUCKET_LEGACY}" ]; then
248-
aws s3 cp analyzers/analyzers.json "s3://${S3_BUCKET_LEGACY}/analyzers.json" --no-progress --content-type "application/json"
249-
aws s3 cp responders/responders.json "s3://${S3_BUCKET_LEGACY}/responders.json" --no-progress --content-type "application/json"
250-
aws s3 cp analyzers/report-templates.zip "s3://${S3_BUCKET_LEGACY}/report-templates.zip" --no-progress --content-type "application/zip"
258+
aws s3 cp analyzers/analyzers.json "s3://${S3_BUCKET_LEGACY}/analyzers.json" --only-show-errors --content-type "application/json"
259+
aws s3 cp responders/responders.json "s3://${S3_BUCKET_LEGACY}/responders.json" --only-show-errors --content-type "application/json"
260+
aws s3 cp analyzers/report-templates.zip "s3://${S3_BUCKET_LEGACY}/report-templates.zip" --only-show-errors --content-type "application/zip"
251261
fi

0 commit comments

Comments
 (0)