diff --git a/.github/workflows/publish-dist.yml b/.github/workflows/publish-dist.yml index cdacb25b7..3c25c7dcc 100644 --- a/.github/workflows/publish-dist.yml +++ b/.github/workflows/publish-dist.yml @@ -274,7 +274,7 @@ jobs: token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }} - name: Update console.vega.xyz DNS to redirect to the new console - if: ${{ matrix.app == 'trading' && github.event_name == 'push' && endsWith(github.ref, 'main') }} + if: ${{ matrix.app == 'trading' && github.event_name == 'push' && ( endsWith(github.ref, 'main') || endsWith(github.ref, 'testnet') ) }} env: GH_TOKEN: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }} run: | @@ -287,9 +287,6 @@ jobs: ls -al ipfs-redirect - echo $new_hash > ipfs-redirect/cidv0.txt - echo $new_cid > ipfs-redirect/cidv1.txt - ( cd ipfs-redirect @@ -300,8 +297,18 @@ jobs: branch_name="update-hash-${{ github.ref }}" git checkout -b "$branch_name" + + if echo ${{ github.ref }} | grep -q main; then + echo $new_hash > cidv0-mainnet.txt + echo $new_cid > cidv1-mainnet.txt + git add cidv0-mainnet.txt cidv1-mainnet.txt + elif echo ${{ github.ref }} | grep -q release/testnet; then + echo $new_hash > cidv0-fairground.txt + echo $new_cid > cidv1-fairground.txt + git add cidv0-fairground.txt cidv1-fairground.txt + fi + commit_msg="Automated hash update from ${{ github.ref }}" - git add cidv0.txt cidv1.txt git commit -m "$commit_msg" git push -u origin "$branch_name" pr_url="$(gh pr create --title "${commit_msg}" --body 'automated pull request to update CIDs')" @@ -310,50 +317,3 @@ jobs: sleep 5 gh pr merge "${pr_url}" --delete-branch --squash --admin ) - - - name: Update console.fairground.wtf DNS to redirect to the new console - if: ${{ matrix.app == 'trading' && github.event_name == 'push' && endsWith(github.ref, 'testnet') }} - run: | - curl -L https://dist.ipfs.tech/kubo/v0.20.0/kubo_v0.20.0_linux-amd64.tar.gz -o kubo.tgz - tar -xzf kubo.tgz - export PATH="$PATH:$PWD/kubo" - which ipfs - new_hash=$(cat ${{ matrix.app }}-ipfs-hash) - new_cid=$(ipfs cid format -v 1 -b base32 $new_hash) - - # Generate console URL - - new_console_url_type=ipfs - # new_console_url_type=ipns - - new_console_url_domain=cf-ipfs.com - # new_console_url_domain=dweb.link - - new_console_url="http://${new_cid}.${new_console_url_type}.${new_console_url_domain}/" - echo "new_console_url=${new_console_url}" - - # Update record in DNSimple - # docs: https://developer.dnsimple.com/v2/zones/records/#updateZoneRecord - dnsimple_account_id=84895 - dnsimple_zone_name=fairground.wtf - dnsimple_record_id=45300615 - # see: https://dnsimple.com/a/84895/domains/fairground.wtf/records/45300615/edit - curl --fail -H 'Authorization: Bearer ${{ secrets.DNSIMPLE_API_TOKEN }}' \ - -H 'Accept: application/json' \ - -H 'Content-Type: application/json' \ - -X PATCH \ - -d "{ - \"content\": \"${new_console_url}\" - }" \ - https://api.dnsimple.com/v2/${dnsimple_account_id}/zones/${dnsimple_zone_name}/records/${dnsimple_record_id} - - # trading.fairground.wtf - dnsimple_record_id=45302531 - curl --fail -H 'Authorization: Bearer ${{ secrets.DNSIMPLE_API_TOKEN }}' \ - -H 'Accept: application/json' \ - -H 'Content-Type: application/json' \ - -X PATCH \ - -d "{ - \"content\": \"${new_console_url}\" - }" \ - https://api.dnsimple.com/v2/${dnsimple_account_id}/zones/${dnsimple_zone_name}/records/${dnsimple_record_id}