-
Notifications
You must be signed in to change notification settings - Fork 64
71 lines (68 loc) · 2.33 KB
/
build_download_site_index_files.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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