From 6ee77e8e823f841413ae942ed515f779b416a98b Mon Sep 17 00:00:00 2001 From: Bernie Reiter Date: Wed, 15 Jan 2020 13:11:57 +0100 Subject: [PATCH] Add logic to download vendor scripts --- .github/workflows/build-release.yml | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 5b137cd74ced3..13287d1d9faf8 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -13,6 +13,36 @@ jobs: steps: - name: Checkout code uses: actions/checkout@master + - name: Download vendor scripts + run: | + vendor_scripts="" + # Using `command | while read...` is more typical, but the inside of the `while` + # loop will run under a separate process this way, meaning that it cannot + # modify $vendor_scripts. See: https://stackoverflow.com/a/16855194 + exec 3< <( + # Get minified versions of vendor scripts. + php bin/get-vendor-scripts.php + # Get non-minified versions of vendor scripts (for SCRIPT_DEBUG). + php bin/get-vendor-scripts.php debug + ) + while IFS='|' read -u 3 url filename; do + echo "$url" + echo -n " > vendor/$filename ... " + http_status=$( curl \ + --location \ + --silent \ + "$url" \ + --output "vendor/_download.tmp.js" \ + --write-out "%{http_code}" + ) + if [ "$http_status" != 200 ]; then + error "HTTP $http_status" + exit 1 + fi + mv -f "vendor/_download.tmp.js" "vendor/$filename" + vendor_scripts="$vendor_scripts vendor/$filename" + done + echo ::set-env name=vendor_scripts::$vendor_scripts - name: Install dependencies run: npm install env: