aboutsummaryrefslogtreecommitdiffstats
path: root/.github/actions/s3cmd/action.yml
blob: ab98660381d12fcecc6fc775b4c53c93c77f7981 (plain) (blame)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: configure s3cmd
description: configure s3cmd
inputs:
  s3_key_id:
    required: true
    description: "s3 key id"
  s3_key_secret:
    required: true
    description: "s3 key secret"
  s3_bucket:
    required: true
    description: "s3 bucket"
  s3_endpoint:
    required: true
    description: "s3 endpoint"
  folder_prefix:
    required: true
    description: "folder prefix"
  build_preset:
    required: true
    description: "build preset like relwithdebinfo"
runs:
  using: "composite"
  steps:
    - name: configure s3cmd
      shell: bash
      run: |
        export S3CMD_CONFIG=$(mktemp)
        echo "S3CMD_CONFIG=$S3CMD_CONFIG" >> $GITHUB_ENV
        cat <<EOF > $S3CMD_CONFIG
        [default]
        access_key = ${s3_key_id}
        secret_key = ${s3_secret_access_key}
        bucket_location = ru-central1
        host_base = storage.yandexcloud.net
        host_bucket = %(bucket)s.storage.yandexcloud.net
        EOF
        
        folder="${{ runner.arch == 'X64' && 'x86-64' || runner.arch == 'ARM64' && 'arm64' || 'unknown' }}"
        
        case "${{ inputs.build_preset }}" in
          relwithdebinfo)
            ;;
          debug)
            folder+="-debug"
            ;;
          release-asan)
            folder+="-asan"
            ;;
          release-tsan)
            folder+="-tsan"
            ;;
          *)
            echo "Invalid preset: ${{ inputs.build_preset }}"
            exit 1
            ;;
        esac

        echo "S3_BUCKET_PATH=s3://${{ inputs.s3_bucket }}/${{ github.repository }}/${{github.workflow}}/${{ github.run_id }}/${{ inputs.folder_prefix }}${folder}" >> $GITHUB_ENV
        echo "S3_URL_PREFIX=${{ inputs.s3_endpoint }}/${{ inputs.s3_bucket }}/${{ github.repository }}/${{ github.workflow }}/${{ github.run_id }}/${{ inputs.folder_prefix }}${folder}" >> $GITHUB_ENV
      env:
        s3_key_id: ${{ inputs.s3_key_id }}
        s3_secret_access_key: ${{ inputs.s3_key_secret }}