Skip to content

Reinstate heimdall registry #15

Reinstate heimdall registry

Reinstate heimdall registry #15

Workflow file for this run

name: Update planets config
on:
workflow_dispatch:
pull_request_target:
paths:
- planets/*.json
branches:
- main
types:
- closed
jobs:
validate-planets-config:
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
uses: ./.github/workflows/validate-planets.yaml
update-planets-config:
needs: [validate-planets-config]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- uses: dorny/paths-filter@v3
id: paths
with:
list-files: shell
filters: |
planets: planets/*.json
- run: |
FILES=(${{ steps.paths.outputs.planets_files }})
for FILE in "${FILES[@]}"; do
REGISTRY=$(echo "$FILE" | sed -r 's/planets\/(.+)\.json$/\1/')
DIR="planets"
if [[ $REGISTRY == "mainnet" ]]; then
BUCKET="planets.nine-chronicles.com"
CF_DISTRIBUTION_ID="EP1JH2OWQMIKM"
else
BUCKET="planets-internal.nine-chronicles.com"
CF_DISTRIBUTION_ID="E2HIZ6JDZX0BEQ"
if [[ $REGISTRY == "preview" ]]; then
DIR="planets-preview"
fi
fi
aws s3 cp $FILE s3://$BUCKET/$DIR/index.json
aws cloudfront create-invalidation --distribution-id $CF_DISTRIBUTION_ID --paths "/*"
done