1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- 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: false
- description: "s3 bucket"
- s3_endpoint:
- required: true
- description: "s3 endpoint"
- folder_prefix:
- required: false
- description: "folder prefix"
- build_preset:
- required: false
- 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
- # specify mime type for correct content-type in s3cmd sync
- # we want to .out/.err files treat as text
- MIME_TYPES_LINE="text/plain out err log"
- MIME_TYPES_FILE='/etc/mime.types'
- # add if not exists
- sudo bash -c "grep -qF -- '$MIME_TYPES_LINE' '$MIME_TYPES_FILE' || echo '$MIME_TYPES_LINE' >> '$MIME_TYPES_FILE'"
- env:
- s3_key_id: ${{ inputs.s3_key_id }}
- s3_secret_access_key: ${{ inputs.s3_key_secret }}
- - name: export s3 path variables
- shell: bash
- if: inputs.build_preset
- run: |
- folder="${{ runner.arch == 'X64' && 'x86-64' || runner.arch == 'ARM64' && 'arm64' || 'unknown' }}"
-
- BUILD_PRESET="${{ inputs.build_preset }}"
-
- case "$BUILD_PRESET" in
- relwithdebinfo)
- ;;
- debug)
- folder+="-debug"
- ;;
- release-*)
- folder+="-${BUILD_PRESET/release-/}"
- ;;
- *)
- 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
- echo "S3_TEST_ARTIFACTS_BUCKET_PATH=s3://${{ inputs.s3_bucket }}/testing_out_stuff/${{ github.repository }}/${{github.workflow}}/${{ github.run_id }}/${{ inputs.folder_prefix }}${folder}" >> $GITHUB_ENV
- echo "S3_TEST_ARTIFACTS_URL_PREFIX=${{ inputs.s3_endpoint }}/${{ inputs.s3_bucket }}/testing_out_stuff/${{ github.repository }}/${{ github.workflow }}/${{ github.run_id }}/${{ inputs.folder_prefix }}${folder}" >> $GITHUB_ENV
|