action.yml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. name: configure s3cmd
  2. description: configure s3cmd
  3. inputs:
  4. s3_key_id:
  5. required: true
  6. description: "s3 key id"
  7. s3_key_secret:
  8. required: true
  9. description: "s3 key secret"
  10. s3_bucket:
  11. required: true
  12. description: "s3 bucket"
  13. s3_endpoint:
  14. required: true
  15. description: "s3 endpoint"
  16. folder_prefix:
  17. required: true
  18. description: "folder prefix"
  19. build_preset:
  20. required: true
  21. description: "build preset like relwithdebinfo"
  22. runs:
  23. using: "composite"
  24. steps:
  25. - name: configure s3cmd
  26. shell: bash
  27. run: |
  28. export S3CMD_CONFIG=$(mktemp)
  29. echo "S3CMD_CONFIG=$S3CMD_CONFIG" >> $GITHUB_ENV
  30. cat <<EOF > $S3CMD_CONFIG
  31. [default]
  32. access_key = ${s3_key_id}
  33. secret_key = ${s3_secret_access_key}
  34. bucket_location = ru-central1
  35. host_base = storage.yandexcloud.net
  36. host_bucket = %(bucket)s.storage.yandexcloud.net
  37. EOF
  38. folder="${{ runner.arch == 'X64' && 'x86-64' || runner.arch == 'ARM64' && 'arm64' || 'unknown' }}"
  39. BUILD_PRESET="${{ inputs.build_preset }}"
  40. case "$BUILD_PRESET" in
  41. relwithdebinfo)
  42. ;;
  43. debug)
  44. folder+="-debug"
  45. ;;
  46. release-*)
  47. folder+="-${BUILD_PRESET/release-/}"
  48. ;;
  49. *)
  50. echo "Invalid preset: ${{ inputs.build_preset }}"
  51. exit 1
  52. ;;
  53. esac
  54. echo "S3_BUCKET_PATH=s3://${{ inputs.s3_bucket }}/${{ github.repository }}/${{github.workflow}}/${{ github.run_id }}/${{ inputs.folder_prefix }}${folder}" >> $GITHUB_ENV
  55. echo "S3_URL_PREFIX=${{ inputs.s3_endpoint }}/${{ inputs.s3_bucket }}/${{ github.repository }}/${{ github.workflow }}/${{ github.run_id }}/${{ inputs.folder_prefix }}${folder}" >> $GITHUB_ENV
  56. 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
  57. 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
  58. env:
  59. s3_key_id: ${{ inputs.s3_key_id }}
  60. s3_secret_access_key: ${{ inputs.s3_key_secret }}