diff --git a/.github/workflows/run.yml b/.github/workflows/run.yml index 9760461ad..9502f5fb2 100644 --- a/.github/workflows/run.yml +++ b/.github/workflows/run.yml @@ -12,6 +12,10 @@ on: schedule: - cron: '0 0 * * *' workflow_dispatch: + inputs: + environment: + type: environment + description: The environment to deploy to. env: DLB_BOT_EMAIL: ${{ secrets.DLB_BOT_EMAIL }} @@ -64,6 +68,46 @@ jobs: - name: Commit docs run: make commit-docs + 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).filter(name => name !== 'github-pages') + + upload_to_s3: + runs-on: ubuntu-latest + needs: [build, detect-environments] + strategy: + matrix: + environment: ${{ fromJSON(needs.detect-environments.outputs.environments) }} + environment: ${{ matrix.environment }} + steps: + - name: Check out repository + uses: actions/checkout@v4 + with: + ref: main + + - 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 ./specification s3://${{ secrets.DEPLOY_COLLECTION_DATA_BUCKET }}/specification + check-build-specification-failure: runs-on: ubuntu-latest needs: