Skip to content

Commit

Permalink
Add logic to download vendor scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham committed Jan 15, 2020
1 parent 9c80675 commit 6ee77e8
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 6ee77e8

Please sign in to comment.