Indexing //dot_net_agent/latest_release in us-east-1 (dry-run=true) by @tippmar-nr #8
This file contains 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: Build Download Site Index Files | |
run-name: Indexing ${{ inputs.bucket }}/${{ inputs.prefix }} in ${{inputs.aws-region}} (dry-run=${{inputs.dry-run}}) by @${{ github.actor }} | |
on: | |
workflow_call: | |
secrets: | |
AWS_ACCESS_KEY_ID: | |
description: 'AWS Access Key ID' | |
required: true | |
AWS_SECRET_ACCESS_KEY: | |
description: 'AWS Secret Access Key' | |
required: true | |
BUCKET_NAME: | |
description: 's3 bucket name, must be prefixed with "s3://"' | |
required: true | |
inputs: | |
aws-region: | |
description: 'AWS region s3 bucket is in' | |
required: true | |
type: string | |
prefix: | |
description: 'object prefix to build index.html for' | |
required: false | |
type: string | |
dry-run: | |
description: 'If true, do a dry run -- output indicates files that would be generated but nothing actually gets uploaded' | |
required: false | |
default: true | |
type: boolean | |
workflow_dispatch: | |
inputs: | |
aws-region: | |
description: 'AWS region s3 bucket is in' | |
required: true | |
type: string | |
prefix: | |
description: 'object prefix to build index.html for' | |
required: false | |
type: string | |
dry-run: | |
description: 'If true, do a dry run -- output indicates files that would be generated but nothing actually gets uploaded' | |
required: false | |
default: true | |
type: boolean | |
permissions: | |
contents: read | |
packages: read | |
jobs: | |
s3-build-index: | |
name: Build index.html files | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/newrelic/s3indexer | |
steps: | |
- name: Login to AWS | |
uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4.0.1 | |
with: | |
aws-region: ${{ inputs.aws-region }} | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: Update index.html files in AWS S3 bucket | |
env: | |
BUCKET_NAME: ${{ secrets.BUCKET_NAME }} | |
run: | | |
if [ ${{ inputs.dry-run }} = true ]; then | |
/opt/nr/bin/s3-indexer -bucket ${BUCKET_NAME:5} -prefix "${{ inputs.prefix }}" | |
else | |
/opt/nr/bin/s3-indexer -bucket ${BUCKET_NAME:5} -prefix "${{ inputs.prefix }}" -upload | |
fi |