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..589aa32 100644 --- a/.github/workflows/detect-new-ver.yml +++ b/.github/workflows/detect-new-ver.yml @@ -21,9 +21,10 @@ 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 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 +32,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 +50,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 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/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')