Detect new version #19
Workflow file for this run
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
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 | |
source .env | |
git restore .env # restore .env | |
echo ibc-ver=${IBC_VER} >> "$GITHUB_OUTPUT" | |
echo ibc-asset-url=${IBC_ASSET_URL} >> "$GITHUB_OUTPUT" | |
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 | |
if [ "$IBC_VER" = "$CUR_IBC_VER" ]; then | |
echo "No dated IBC version" | |
echo has_update=false >> "$GITHUB_OUTPUT" | |
else | |
echo "New IBC version($IBC_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 }}-ibc${{steps.check-update.outputs.ibc-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 | |
echo "CUR_IB_GATEWAY_VER=${{ steps.check-update.outputs.ib-gateway-ver }}" > .env | |
echo "CUR_IBC_VER=${{ steps.check-update.outputs.ibc-ver }}" >> .env | |
##### | |
git add README.md | |
git add Dockerfile | |
git add .env | |
git commit -m 'Update to `${{ steps.check-update.outputs.ib-gateway-ver }}`' | |
git push --set-upstream origin "$branch" | |
gh pr create --base develop --fill | |