summaryrefslogtreecommitdiffstats
path: root/.github/workflows/upload-file-s3.yml
blob: 6bcb172468da9c3aeffc2805cb4320756dfe8f0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Upload File to S3

on:
  workflow_call:
    secrets:
      s3_access_key:
      s3_secret_key:
    inputs:
      endpoint:
        required: true
        type: string
      bucket:
        required: true
        type: string
      download_id:
        required: true
        type: string
      filename:
        required: true
        type: string

jobs:
  upload-file-in-s3:
    name: Upload file in S3
    runs-on: ubuntu-latest

    steps:
      - name: Install minio
        run: |
          curl https://dl.min.io/client/mc/release/linux-amd64/mc \
            --create-dirs \
            -o $GITHUB_WORKSPACE/minio-binaries/mc

          chmod +x $GITHUB_WORKSPACE/minio-binaries/mc
          echo $GITHUB_WORKSPACE/minio-binaries/ >> $GITHUB_PATH

      - name: Setup minio
        run: mc alias set s3 ${{ inputs.endpoint }} ${{ secrets.s3_access_key }} ${{ secrets.s3_secret_key }}

      - name: Download file
        uses: actions/download-artifact@v3
        with:
          name: ${{ inputs.download_id }}

      - name: Upload file to s3
        run: mc cp ${{ inputs.filename }} s3/${{ inputs.bucket }}/