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/6] 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 9f873ab8..7481c8c4 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 00000000..101f600c --- /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/6] 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 101f600c..aabfd447 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/6] 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 aabfd447..7a42706b 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 From a5dc0dffb94010f9c9488dc0f2260f52a6eb8db8 Mon Sep 17 00:00:00 2001 From: Norbert Elter <72046715+itsyoboieltr@users.noreply.github.com> Date: Tue, 21 Jan 2025 21:42:05 +0400 Subject: [PATCH 4/6] Update action.yml --- .github/actions/setup-environment/action.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/actions/setup-environment/action.yml b/.github/actions/setup-environment/action.yml index 7481c8c4..9f873ab8 100644 --- a/.github/actions/setup-environment/action.yml +++ b/.github/actions/setup-environment/action.yml @@ -1,7 +1,5 @@ name: Setup environment - description: Setup environment - runs: using: composite steps: From 460b23e21abb0269f84f438bae858da6ddd01ed2 Mon Sep 17 00:00:00 2001 From: Norbert Elter <72046715+itsyoboieltr@users.noreply.github.com> Date: Tue, 21 Jan 2025 21:43:59 +0400 Subject: [PATCH 5/6] fix: quotes --- .github/actions/upload-s3/action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/upload-s3/action.yml b/.github/actions/upload-s3/action.yml index 7a42706b..78c9ccd7 100644 --- a/.github/actions/upload-s3/action.yml +++ b/.github/actions/upload-s3/action.yml @@ -27,9 +27,9 @@ runs: - name: Upload to S3 run: | - if [ -d ${{ inputs.path }} ]; then - aws s3 cp ${{ inputs.path }} s3://${{ inputs.s3-bucket }} --recursive + 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 }} + aws s3 cp "${{ inputs.path }}" "s3://${{ inputs.s3-bucket }}" fi shell: bash From 94dbe0a13c80e50d35b510c17472cf6029bdf0b5 Mon Sep 17 00:00:00 2001 From: Norbert Elter <72046715+itsyoboieltr@users.noreply.github.com> Date: Tue, 21 Jan 2025 22:02:36 +0400 Subject: [PATCH 6/6] Update action.yml --- .github/actions/upload-s3/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/upload-s3/action.yml b/.github/actions/upload-s3/action.yml index 78c9ccd7..655a43c4 100644 --- a/.github/actions/upload-s3/action.yml +++ b/.github/actions/upload-s3/action.yml @@ -20,7 +20,8 @@ runs: using: composite steps: - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v4 + # aws-actions/configure-aws-credentials@v4 + uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 with: aws-region: ${{ inputs.aws-region }} role-to-assume: ${{ inputs.role-to-assume }}