diff --git a/.github/workflows/deployment-s3.yml b/.github/workflows/deployment-s3.yml new file mode 100644 index 0000000..e9e86ed --- /dev/null +++ b/.github/workflows/deployment-s3.yml @@ -0,0 +1,50 @@ +name: Upload files to AWS S3 +on: + workflow_call: + inputs: + aws_region: + description: 'AWS region' + required: false + type: string + default: eu-west-1 + files_path: + description: 'The path to the files to copy' + required: false + type: string + default: . + artifact_name: + description: 'The name of the artifact to download' + required: false + type: string + secrets: + bucket_path: + required: true + description: The path to the S3 bucket to copy files to + aws_access_key_id: + required: true + description: The AWS access key ID + aws_secret_access_key: + required: true + description: The AWS secret access key + +jobs: + upload: + runs-on: ubuntu-latest + steps: + - name: Download artifacts + if: ${{ inputs.artifact_name }} + uses: actions/download-artifact@v3 + with: + name: ${{ inputs.artifact_name }} + path: ${{ inputs.files_path }} + + - name: Copy files to S3 + env: + AWS_ACCESS_KEY_ID: ${{ secrets.aws_access_key_id }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_access_key }} + run: | + aws s3 cp \ + --recursive \ + --region ${{ inputs.aws_region }} \ + ${{ inputs.files_path }} \ + s3://${{ secrets.bucket_path }} diff --git a/README.md b/README.md index bd7fcc5..ee5cdb1 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ jobs: | automation | [comment-pr](./.github/workflows/automation-comment-pr.yml) | Add or update a comment on the pull request | | automation | [greeter](./.github/workflows/automation-greeter.yml) | Greetings | | automation | [labeler](./.github/workflows/automation-labeler.yml) | Labeler | +| deployment | [s3](./.github/workflows/deployment-s3.yml) | Upload files to AWS S3 | | integration | [commit-validator](./.github/workflows/integration-commit-validator.yml) | Validate commit or PR title format is correct | | integration | [linter-pre-commit](./.github/workflows/integration-linter-pre-commit.yml) | Pre-commit | | integration | [modification-script](./.github/workflows/integration-modification-script.yml) | Execute script and commit changes to git |