Skip to content

Detect new version

Detect new version #12

Workflow file for this run

name: Detect new version
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
env:
IMAGE_NAME: ib-gateway-docker
steps:
- uses: actions/checkout@master
- name: Setup python
uses: actions/setup-python@v5
- name: detect new ib gateway version
id: check-update
run: |
IB_GATEWAY_VER=$(python scripts/detect_ib_gateway_ver.py)
echo ib-gateway-ver=${IB_GATEWAY_VER} >> "$GITHUB_OUTPUT"
python scripts/detect_ibc_ver.py
echo ibc-ver=${IBC_VER} >> "$GITHUB_OUTPUT"
echo ibc-asset-url=${IBC_ASSET_URL} >> "$GITHUB_OUTPUT"
source default.env
if [ "$IB_GATEWAY_VER" = "$CUR_IB_GATEWAY_VER" ]; then
echo "No dated IB gateway version"
echo has_update=false >> "$GITHUB_OUTPUT"
else
echo "New IB gateway version($IB_GATEWAY_VER)"
echo has_update=true >> "$GITHUB_OUTPUT"
fi
- name: Update files with new version
if: steps.check-update.outputs.has_update == 'true'
run: |
cat README.template | envsubst > README.update
cat Dockerfile.template | envsubst > Dockerfile.update
- name: Create PR
if: ${{ steps.check-update.outputs.has_update == 'true' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
branch='feat/update-to-${{ steps.check-update.outputs.ib-gateway-ver }}'
git config user.name github-actions
git config user.email [email protected]
git pull
git checkout -b "$branch" origin/develop
# Update files
cp README.update README.md
cp Dockerfile.update Dockerfile
#####
git add README.md
git add Dockerfile
git commit -m 'Update to `${{ steps.check-update.outputs.ib-gateway-ver }}`'
git push --set-upstream origin "$branch"
gh pr create --base develop --fill