Skip to content

Commit

Permalink
Fix: プライベートリポジトリからエンジンをダウンロードできるよう修正
Browse files Browse the repository at this point in the history
  • Loading branch information
tsukumijima committed Nov 8, 2024
1 parent c71dea4 commit afa43d3
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions .github/actions/download-engine/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit afa43d3

Please sign in to comment.