name: upload-artifact description: "Uploads an artifact. Does not compress it or anything - supports just one file." inputs: path: required: true description: "Path to the file that should be uploaded" artifact-name: required: true description: "Name of the resulting artifact" runs: using: composite steps: - run: | set -euxo pipefail ARTIFACT_BASE="${ACTIONS_RUNTIME_URL}_apis/pipelines/workflows/${GITHUB_RUN_ID}/artifacts?api-version=6.0-preview" FILE_SIZE_BYTES=$(wc -c < ${{ inputs.path }}) FILE_SIZE_BYTES_MINUS_ONE=$(echo $FILE_SIZE_BYTES - 1 | bc) RESOURCE_URL="$( curl \ -XPOST \ --silent \ --fail-with-body \ --header "Authorization: Bearer ${{ github.token }}" \ --header 'Accept: application/json;api-version=6.0-preview' \ --header 'Content-Type: application/json' \ --data '{"type": "actions_storage", "name": "${{ inputs.artifact-name }}"}' \ $ARTIFACT_BASE | tee /dev/stderr | jq --exit-status --raw-output .fileContainerResourceUrl \2 )" curl \ -XPUT \ --silent \ --fail-with-body \ --header 'Accept: application/json;api-version=6.0-preview' \ --header "Authorization: Bearer ${{ github.token }}" \ --header 'Content-Type: application/octet-stream' \ --header "Content-Range: bytes 0-${FILE_SIZE_BYTES_MINUS_ONE}/${FILE_SIZE_BYTES}" \ --data-binary "@${{ inputs.path }}" \ "${RESOURCE_URL}?itemPath=${{ inputs.artifact-name }}/$(basename ${{ inputs.path }})" curl \ -XPATCH \ --silent \ --fail-with-body \ --header 'Accept: application/json;api-version=6.0-preview' \ --header "Authorization: Bearer ${{ github.token }}" \ --header 'Content-Type: application/json' \ --data '{"size": ${FILE_SIZE_BYTES}}' \ "${ARTIFACT_BASE}&artifactName=${{ inputs.artifact-name }}" shell: sh