Merge pull request #358 from digital-land/gs/ECA-new-ca-data #62
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: Upload to S3 | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
environment: | |
type: environment | |
description: The environment to deploy to. | |
jobs: | |
detect-environments: | |
runs-on: ubuntu-latest | |
outputs: | |
environments: ${{ steps.environments.outputs.result }} | |
steps: | |
- uses: actions/github-script@v6 | |
id: environments | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
result-encoding: json | |
script: | | |
if (context.payload?.inputs?.environment) return [context.payload?.inputs?.environment]; | |
const {data: {environments}} = | |
await github.request(`GET /repos/${process.env.GITHUB_REPOSITORY}/environments`); | |
return environments.map(e => e.name) | |
upload_to_S3: | |
runs-on: ubuntu-latest | |
needs: [detect-environments] | |
strategy: | |
matrix: | |
environment: ${{ fromJSON(needs.detect-environments.outputs.environments) }} | |
environment: ${{ matrix.environment }} | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1-node16 | |
with: | |
aws-access-key-id: ${{ secrets.DEPLOY_AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.DEPLOY_AWS_SECRET_ACCESS_KEY }} | |
aws-region: eu-west-2 | |
- name: Save to S3 | |
run: | | |
aws s3 sync ./collection s3://${{ secrets.DEPLOY_COLLECTION_DATA_BUCKET }}/config/collection | |
aws s3 sync ./pipeline s3://${{ secrets.DEPLOY_COLLECTION_DATA_BUCKET }}/config/pipeline |