-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
installer: cleanup & fix CI/CD issues caused by rate limits in the Gi…
…thub API
- Loading branch information
1 parent
190f880
commit 1cf9610
Showing
5 changed files
with
63 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,56 @@ | ||
@echo off | ||
setlocal enabledelayedexpansion | ||
|
||
FOR /F "tokens=*" %%g IN ('git config --get remote.origin.url') do (SET remote=%%g) | ||
echo %remote% | findstr /C:"github.com/aspl-lang/aspl" > nul && ( | ||
git "pull" "origin" "main" | ||
git pull origin main | ||
) || ( | ||
git "clone" "https://github.com/aspl-lang/aspl.git" | ||
cd "aspl" | ||
git clone https://github.com/aspl-lang/aspl.git | ||
cd aspl | ||
) | ||
|
||
curl -L -o jq.exe https://github.com/stedolan/jq/releases/latest/download/jq-win64.exe | ||
|
||
(curl -s https://api.github.com/repos/aspl-lang/cd/contents/latest.txt | jq -r .content) > sha.txt | ||
IF DEFINED GITHUB_TOKEN ( | ||
SET AUTH_HEADER=Authorization: token %GITHUB_TOKEN% | ||
) ELSE ( | ||
SET AUTH_HEADER= | ||
) | ||
|
||
curl -s -H "%AUTH_HEADER%" https://api.github.com/repos/aspl-lang/cd/contents/latest.txt | jq -r .content > sha.txt | ||
certutil -decode sha.txt sha_decoded.txt | ||
SET /p SHA=<sha_decoded.txt | ||
DEL sha.txt | ||
DEL sha_decoded.txt | ||
SET CURL=curl https://api.github.com/repos/aspl-lang/cd/releases | ||
|
||
if %PROCESSOR_ARCHITECTURE% == AMD64 ( | ||
IF "%PROCESSOR_ARCHITECTURE%"=="AMD64" ( | ||
SET EXECUTABLE=aspl_windows_x86_64.exe | ||
) | ||
if %PROCESSOR_ARCHITECTURE% == IA64 ( | ||
) ELSE IF "%PROCESSOR_ARCHITECTURE%"=="IA64" ( | ||
SET EXECUTABLE=aspl_windows_x86_64.exe | ||
) | ||
if %PROCESSOR_ARCHITECTURE% == ARM64 ( | ||
) ELSE IF "%PROCESSOR_ARCHITECTURE%"=="ARM64" ( | ||
SET EXECUTABLE=aspl_windows_arm64.exe | ||
) | ||
if not defined EXECUTABLE ( | ||
) ELSE ( | ||
echo Unsupported architecture | ||
exit /b 1 | ||
) | ||
|
||
(%CURL%/tags/SHA-%SHA% | jq .assets | jq ".[] | select(.name == \"%EXECUTABLE%\").id") > id.txt | ||
curl -H "%AUTH_HEADER%" https://api.github.com/repos/aspl-lang/cd/releases/tags/SHA-%SHA% -s | jq .assets | jq ".[] | select(.name == \"%EXECUTABLE%\").id" > id.txt | ||
SET /p ASSET_ID=<id.txt | ||
%CURL%/assets/%ASSET_ID% -LJOH "Accept: application/octet-stream" | ||
DEL id.txt | ||
echo Downloading %EXECUTABLE% (%ASSET_ID%): | ||
curl -H "%AUTH_HEADER%" -LJOH "Accept: application/octet-stream" https://api.github.com/repos/aspl-lang/cd/releases/assets/%ASSET_ID% | ||
rename %EXECUTABLE% aspl.exe | ||
setx PATH "%PATH%;%CD%" | ||
|
||
(%CURL%/tags/SHA-%SHA% | jq .assets | jq ".[] | select(.name == \"templates.zip\").id") > id.txt | ||
echo Make the `aspl` command available everywhere (by adding it to the PATH?)? (y/n): | ||
set /p choice= | ||
if /i "%choice%"=="y" setx PATH "%PATH%;%CD%" | ||
|
||
curl -H "%AUTH_HEADER%" https://api.github.com/repos/aspl-lang/cd/releases/tags/SHA-%SHA% -s | jq .assets | jq ".[] | select(.name == \"templates.zip\").id" > id.txt | ||
SET /p ASSET_ID=<id.txt | ||
DEL id.txt | ||
%CURL%/assets/%ASSET_ID% -LJOH "Accept: application/octet-stream" | ||
tar -xf "templates.zip" | ||
DEL "templates.zip" | ||
echo Downloading templates.zip (%ASSET_ID%): | ||
curl -H "%AUTH_HEADER%" -LJOH "Accept: application/octet-stream" https://api.github.com/repos/aspl-lang/cd/releases/assets/%ASSET_ID% | ||
tar -xf templates.zip | ||
DEL templates.zip | ||
|
||
DEL jq.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.