Skip to content

Auto-update casks on new releases #33867

Auto-update casks on new releases

Auto-update casks on new releases #33867

Workflow file for this run

name: Auto-update casks on new releases
on:
workflow_dispatch:
schedule:
- cron: "0 * * * *"
jobs:
scheduled:
runs-on: ubuntu-latest
steps:
- name: Check out this repo
uses: actions/checkout@v4
- name: Fetch latest versions
run: |-
MILLISECONDS=$(date '+%s')$(($RANDOM % 1000))
curl "https://download2.interactivebrokers.com/installers/tws/latest-standalone/version.json?_=$MILLISECONDS&callback=twslatest_callback" | jq -R 'capture("\\((?<x>.*)\\)[^)]*$").x | fromjson | .buildVersion' > latest
curl "https://download2.interactivebrokers.com/installers/tws/stable-standalone/version.json?_=$MILLISECONDS&callback=twsstable_callback" | jq -R 'capture("\\((?<x>.*)\\)[^)]*$").x | fromjson | .buildVersion' > stable
curl "https://download2.interactivebrokers.com/installers/tws/beta/version.json?_=$MILLISECONDS&callback=twsbetaupdatable_callback" | jq -R 'capture("\\((?<x>.*)\\)[^)]*$").x | fromjson | .buildVersion' > beta
curl "https://download2.interactivebrokers.com/installers/ntws/latest-standalone/version.json?_=$MILLISECONDS&callback=ntwslatest_callback" | jq -R 'capture("\\((?<x>.*)\\)[^)]*$").x | fromjson | .buildVersion' > ntws_latest
- name: Update Casks
run: |-
sed -i "s/version .*/version $(cat latest)/g" Casks/trader-workstation-latest.rb
sed -i "s/version .*/version $(cat stable)/g" Casks/trader-workstation-stable.rb
sed -i "s/version .*/version $(cat beta)/g" Casks/trader-workstation-beta.rb
sed -i "s/version .*/version $(cat ntws_latest)/g" Casks/ibkr-desktop-latest.rb
if [[ `git status --porcelain` ]]; then
echo "New versions detected"
echo " Latest: $(cat latest)"
echo " Stable: $(cat stable)"
echo " Beta: $(cat beta)"
echo " IBKR Desktop: $(cat ntws_latest)"
rm latest
rm stable
rm beta
rm ntws_latest
git config user.name "Auto Updater"
git config user.email "actions@users.noreply.github.com"
git add -A
timestamp=$(date -u)
git commit -m "Auto-update TWS Casks: ${timestamp}" || exit 0
git push
fi