From 70339cee2ed54cefda54a62106a2e8258361db9b Mon Sep 17 00:00:00 2001 From: Norbert Elter <72046715+itsyoboieltr@users.noreply.github.com> Date: Wed, 15 Jan 2025 00:23:37 +0400 Subject: [PATCH 1/3] feat: upload-s3 --- .github/actions/setup-environment/action.yml | 2 ++ .github/actions/upload-s3/action.yml | 30 ++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 .github/actions/upload-s3/action.yml diff --git a/.github/actions/setup-environment/action.yml b/.github/actions/setup-environment/action.yml index 9f873ab..7481c8c 100644 --- a/.github/actions/setup-environment/action.yml +++ b/.github/actions/setup-environment/action.yml @@ -1,5 +1,7 @@ name: Setup environment + description: Setup environment + runs: using: composite steps: diff --git a/.github/actions/upload-s3/action.yml b/.github/actions/upload-s3/action.yml new file mode 100644 index 0000000..101f600 --- /dev/null +++ b/.github/actions/upload-s3/action.yml @@ -0,0 +1,30 @@ +name: Upload S3 + +description: Upload S3 + +inputs: + aws-region: + required: true + type: string + role-to-assume: + required: true + type: string + path: + required: true + type: string + s3-bucket: + required: true + type: string + +runs: + using: composite + steps: + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-region: ${{ inputs.aws-region }} + role-to-assume: ${{ inputs.role-to-assume }} + + - name: Upload to S3 + run: aws s3 cp ${{ inputs.path }} s3://${{ inputs.s3-bucket }} --recursive + shell: bash From 2d79ed1954b571342bc7ee3ffca0b357354b58c0 Mon Sep 17 00:00:00 2001 From: Norbert Elter <72046715+itsyoboieltr@users.noreply.github.com> Date: Wed, 15 Jan 2025 00:34:34 +0400 Subject: [PATCH 2/3] Update action.yml --- .github/actions/upload-s3/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/upload-s3/action.yml b/.github/actions/upload-s3/action.yml index 101f600..aabfd44 100644 --- a/.github/actions/upload-s3/action.yml +++ b/.github/actions/upload-s3/action.yml @@ -9,10 +9,10 @@ inputs: role-to-assume: required: true type: string - path: + s3-bucket: required: true type: string - s3-bucket: + path: required: true type: string From 5d1f7a2558428c28ecd167e43b4c3aa926a3b162 Mon Sep 17 00:00:00 2001 From: Norbert Elter <72046715+itsyoboieltr@users.noreply.github.com> Date: Wed, 15 Jan 2025 01:52:04 +0400 Subject: [PATCH 3/3] feat: handle single files --- .github/actions/upload-s3/action.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/actions/upload-s3/action.yml b/.github/actions/upload-s3/action.yml index aabfd44..7a42706 100644 --- a/.github/actions/upload-s3/action.yml +++ b/.github/actions/upload-s3/action.yml @@ -26,5 +26,10 @@ runs: role-to-assume: ${{ inputs.role-to-assume }} - name: Upload to S3 - run: aws s3 cp ${{ inputs.path }} s3://${{ inputs.s3-bucket }} --recursive + run: | + if [ -d ${{ inputs.path }} ]; then + aws s3 cp ${{ inputs.path }} s3://${{ inputs.s3-bucket }} --recursive + else + aws s3 cp ${{ inputs.path }} s3://${{ inputs.s3-bucket }} + fi shell: bash