diff --git a/.github/actions/download-engine/action.yml b/.github/actions/download-engine/action.yml index fe39b1e9..ea1620ea 100644 --- a/.github/actions/download-engine/action.yml +++ b/.github/actions/download-engine/action.yml @@ -69,18 +69,25 @@ runs: # リリース情報からファイル一覧の txt を取得 cat $TEMPDIR/target.json | jq -er '[.assets[] | select(.name | contains("'$TARGET'") and endswith(".7z.txt"))][0]' > $TEMPDIR/assets_txt.json - LIST_URL=$(cat $TEMPDIR/assets_txt.json | jq -er '.browser_download_url') - echo "7z.txt url: $LIST_URL" - echo $LIST_URL | xargs curl -sSL -H "Authorization: Bearer ${{ inputs.token }}" > $TEMPDIR/download_name.txt + + # アセットIDを取得してダウンロード + ASSET_ID=$(cat $TEMPDIR/assets_txt.json | jq -er '.id') + curl -sL -H 'Accept: application/octet-stream' \ + "https://${{ inputs.token }}@api.github.com/repos/${{ inputs.repo }}/releases/assets/$ASSET_ID" \ + > $TEMPDIR/download_name.txt + echo "Files to download:" cat $TEMPDIR/download_name.txt | sed -e 's|^|- |' # ファイル一覧の txt にあるファイルをダウンロード for i in $(cat $TEMPDIR/download_name.txt); do - URL=$(cat $TEMPDIR/target.json | jq -er "[.assets[] | select(.name == \"$i\")][0].browser_download_url") - echo "Download url: $URL, dest: $TEMPDIR/$i" - curl -sSL -H "Authorization: Bearer ${{ inputs.token }}" $URL -o $TEMPDIR/$i & + ASSET_ID=$(cat $TEMPDIR/target.json | jq -er "[.assets[] | select(.name == \"$i\")][0].id") + echo "Download asset id: $ASSET_ID, name: $i" + curl -sL -H 'Accept: application/octet-stream' \ + "https://${{ inputs.token }}@api.github.com/repos/${{ inputs.repo }}/releases/assets/$ASSET_ID" \ + -o "$TEMPDIR/$i" & done + for job in `jobs -p`; do wait $job done