diff --git a/default.env b/.env similarity index 100% rename from default.env rename to .env diff --git a/.github/workflows/detect-new-ver.yml b/.github/workflows/detect-new-ver.yml index 5263deb..1bebf2c 100644 --- a/.github/workflows/detect-new-ver.yml +++ b/.github/workflows/detect-new-ver.yml @@ -21,9 +21,11 @@ jobs: 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" - source default.env + if [ "$IB_GATEWAY_VER" = "$CUR_IB_GATEWAY_VER" ]; then echo "No dated IB gateway version" echo has_update=false >> "$GITHUB_OUTPUT" @@ -31,6 +33,14 @@ jobs: 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: | @@ -41,7 +51,7 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - branch='feat/update-to-${{ steps.check-update.outputs.ib-gateway-ver }}' + 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 github-actions@github.com git pull @@ -49,11 +59,12 @@ jobs: # Update files cp README.update README.md cp Dockerfile.update Dockerfile - echo "CUR_IB_GATEWAY_VER=${{ steps.check-update.outputs.ib-gateway-ver }}`" > default.env - echo "CUR_IBC_VER=${{ steps.check-update.outputs.ibc-ver }}`" >> default.env + 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" diff --git a/.gitignore b/.gitignore index d3a4a72..e61ba81 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ *.pyc .secrets -.env .vscode diff --git a/ib-gateway-ver b/ib-gateway-ver deleted file mode 100644 index 0d97b52..0000000 --- a/ib-gateway-ver +++ /dev/null @@ -1 +0,0 @@ -10.19.2 \ No newline at end of file diff --git a/ibc-ver b/ibc-ver deleted file mode 100644 index ae56155..0000000 --- a/ibc-ver +++ /dev/null @@ -1 +0,0 @@ -3.18.0 \ No newline at end of file diff --git a/scripts/detect_ibc_ver.py b/scripts/detect_ibc_ver.py index 464483e..a10266d 100644 --- a/scripts/detect_ibc_ver.py +++ b/scripts/detect_ibc_ver.py @@ -10,7 +10,7 @@ for asset in latest["assets"]: if asset["name"].startswith("IBCLinux"): asset_url = asset["browser_download_url"] - os.putenv("IBC_VER", ver) - os.putenv("IBC_ASSET_URL", asset_url) - print(ver) - print(asset_url) + + with open('.env', 'a') as fp: + fp.write(f'IBC_VER={ver}\n') + fp.write(f'IBC_ASSET_URL={asset_url}\n')