From 002bc4f188d5f7886619c605c5f0b86be76df313 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20M=C5=82odzikowski?= Date: Wed, 24 May 2023 12:36:11 +0200 Subject: [PATCH] feat: regenerate hashes on interstitial page (#3926) --- .github/workflows/publish-dist.yml | 71 +++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 21 deletions(-) diff --git a/.github/workflows/publish-dist.yml b/.github/workflows/publish-dist.yml index 3222d8d8f..947cfe7ab 100644 --- a/.github/workflows/publish-dist.yml +++ b/.github/workflows/publish-dist.yml @@ -200,8 +200,18 @@ jobs: -d '{"query": "mutation{triggerDeploy(siteId:\"f8f2e051-f18e-49e6-b876-0a39369dc0d8\"){id status}}"}' \ https://api.fleek.co/graphql + - name: Check out ipfs-redirect + if: ${{ matrix.app == 'trading' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }} + uses: actions/checkout@v3 + with: + path: 'ipfs-redirect' + fetch-depth: '0' + token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }} + - name: Update vega.trading DNS to redirect to the new console if: ${{ matrix.app == 'trading' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }} + env: + GH_TOKEN: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }} 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 @@ -210,26 +220,45 @@ jobs: 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="https://${new_cid}.${new_console_url_type}.${new_console_url_domain}/" - echo "new_console_url=${new_console_url}" + cd ipfs-redirect + echo $new_hash > cidv0.txt + echo $new_cid > cidv1.txt - # Update record in DNSimple - # docs: https://developer.dnsimple.com/v2/zones/records/#updateZoneRecord - dnsimple_account_id=84895 - dnsimple_zone_name=vega.trading - dnsimple_record_id=44409591 - # see: https://dnsimple.com/a/84895/domains/vega.trading/records/44409591/edit + git config --global user.email "vega-ci-bot@vega.xyz" + git config --global user.name "vega-ci-bot" - curl -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} + branch_name="update-hash-${{ github.ref }}" + git checkout -b "$branch_name" + 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}")" + echo $pr_url + # once auto merge get's enabled on documentation repo let's do follow up + sleep 5 + gh pr merge "${pr_url}" --auto --delete-branch --squash --admin + + # # 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="https://${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=vega.trading + # dnsimple_record_id=44409591 + # # see: https://dnsimple.com/a/84895/domains/vega.trading/records/44409591/edit + + # curl -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}