Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update setup-gams #12

Merged
merged 15 commits into from
Feb 6, 2024
1 change: 0 additions & 1 deletion setup-gams/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ runs:
env:
RUNNER_OS: ${{ runner.os }}
GAMS_VERSION: ${{ inputs.version }}
GHA_PATH: ${{ github.action_path }}
run: ${GITHUB_ACTION_PATH}/script.sh
shell: bash

Expand Down
9 changes: 4 additions & 5 deletions setup-gams/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,21 @@ BASE=$(realpath gams)
# GAMS source URL fragment, and path fragment for extracted files
case $RUNNER_OS in
Linux)
CACHE_PATH="$GITHUB_ACTION_PATH/gams.exe"
GAMS_OS=linux
FRAGMENT=${GAMS_OS}_x64_64_sfx
;;
macOS)
CACHE_PATH="$GITHUB_ACTION_PATH/gams.exe"
GAMS_OS=macosx
FRAGMENT=osx_x64_64_sfx
;;
Windows)
CACHE_PATH="$GHA_PATH\\gams.exe"
GAMS_OS=windows
FRAGMENT=${GAMS_OS}_x64_64
;;
esac

CACHE_PATH="$GITHUB_ACTION_PATH/gams.exe"

# Path fragment for extraction or install
DEST=gams$(echo $GAMS_VERSION | cut -d. -f1-2)_$FRAGMENT

Expand All @@ -46,14 +45,14 @@ if [ -x gams.exe ]; then
TIME_CONDITION=--remote-time --time-cond gams.exe
fi

curl --silent $URL --output gams.exe $TIME_CONDITION
curl --output gams.exe $TIME_CONDITION $URL

# TODO confirm checksum

if [ $GAMS_OS = "windows" ]; then
# Write a PowerShell script. Install to the same directory as *nix unzip
cat << EOF >install-gams.ps1
Start-Process "gams.exe" "/SP-", "/SILENT", "/DIR=$GHA_PATH\\$DEST", "/NORESTART" -Wait
Start-Process "gams.exe" "/SP-", "/SILENT", "/DIR=$GITHUB_ACTION_PATH\\$DEST", "/NORESTART" -Wait
EOF
cat install-gams.ps1

Expand Down