action.yml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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: false
  12. description: "s3 bucket"
  13. s3_endpoint:
  14. required: true
  15. description: "s3 endpoint"
  16. folder_prefix:
  17. required: false
  18. description: "folder prefix"
  19. build_preset:
  20. required: false
  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. env:
  39. s3_key_id: ${{ inputs.s3_key_id }}
  40. s3_secret_access_key: ${{ inputs.s3_key_secret }}
  41. - name: export s3 path variables
  42. shell: bash
  43. if: inputs.build_preset
  44. run: |
  45. folder="${{ runner.arch == 'X64' && 'x86-64' || runner.arch == 'ARM64' && 'arm64' || 'unknown' }}"
  46. BUILD_PRESET="${{ inputs.build_preset }}"
  47. case "$BUILD_PRESET" in
  48. relwithdebinfo)
  49. ;;
  50. debug)
  51. folder+="-debug"
  52. ;;
  53. release-*)
  54. folder+="-${BUILD_PRESET/release-/}"
  55. ;;
  56. *)
  57. echo "Invalid preset: ${{ inputs.build_preset }}"
  58. exit 1
  59. ;;
  60. esac
  61. echo "S3_BUCKET_PATH=s3://${{ inputs.s3_bucket }}/${{ github.repository }}/${{github.workflow}}/${{ github.run_id }}/${{ inputs.folder_prefix }}${folder}" >> $GITHUB_ENV
  62. echo "S3_URL_PREFIX=${{ inputs.s3_endpoint }}/${{ inputs.s3_bucket }}/${{ github.repository }}/${{ github.workflow }}/${{ github.run_id }}/${{ inputs.folder_prefix }}${folder}" >> $GITHUB_ENV
  63. 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
  64. 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