diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 08d2ce7..33a1f9c 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -17,9 +17,11 @@ jobs: apt-get update apt-get install --quiet -y git jq curl unzip - name: Install ASPL + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | cd $GITHUB_WORKSPACE - ./install_ci.sh + ./install.sh - name: Install runtime dependencies run: | apt-get update @@ -82,9 +84,11 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Install ASPL + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | cd $GITHUB_WORKSPACE - ./install_ci.sh + ./install.sh - name: Install runtime dependencies run: | brew install glfw # for the graphics module @@ -118,9 +122,11 @@ jobs: apt-get update apt-get install --quiet -y git jq curl unzip xz-utils build-essential - name: Install ASPL + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | cd $GITHUB_WORKSPACE - ./install_ci.sh + ./install.sh # - name: Delete template (macOS x86_64) # run: | # rm templates/macos/x86_64/Template @@ -292,8 +298,11 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Install ASPL + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - $GITHUB_WORKSPACE/install_ci.sh + cd $GITHUB_WORKSPACE + ./install.sh - name: Run tests run: | cd $GITHUB_WORKSPACE diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index ccb7503..af1b76d 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -11,9 +11,11 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Install ASPL + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | cd $GITHUB_WORKSPACE - ./install_ci.sh + ./install.sh - name: Generate docs run: | cd $GITHUB_WORKSPACE diff --git a/install.bat b/install.bat index 5a8e239..19780bc 100755 --- a/install.bat +++ b/install.bat @@ -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= 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 +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=