From 9b9389670c481a3503e90df0fadc13362026d6d5 Mon Sep 17 00:00:00 2001 From: Daniel N <2color@users.noreply.github.com> Date: Mon, 3 Feb 2025 09:00:43 +0100 Subject: [PATCH] ci: fix DNSLink CID fixes #5 --- .github/workflows/build.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c40ae79..0347562 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,6 +21,8 @@ concurrency: jobs: build-and-deploy: runs-on: ubuntu-latest + outputs: + cid: ${{ steps.deploy.outputs.cid }} steps: - name: Checkout code uses: actions/checkout@v4 @@ -60,6 +62,15 @@ jobs: steps: - name: Update DNSLink run: | + if [ -z "${{ env.DNSLINK_NAME }}" ]; then + echo "Error: DNSLINK_NAME is empty. Skipping DNSLink update." + exit 1 + fi + if [ -z "${{ env.DNSLINK_CID }}" ]; then + echo "Error: DNSLINK_CID is empty. Skipping DNSLink update." + exit 1 + fi + echo "Updating DNSLink for: ${{ env.DNSLINK_NAME }}" curl --request PUT \ --header "Authorization: Bearer ${AUTH_TOKEN}" \ @@ -67,8 +78,8 @@ jobs: --url "https://api.cloudflare.com/client/v4/zones/${ZONE_ID}/dns_records/${RECORD_ID}" \ --data "{ \"type\": \"TXT\", - \"name\": \"_dnslink.${DNSLINK_NAME}\", - \"content\": \"dnslink=/ipfs/${DNSLINK_CID}\", + \"name\": \"_dnslink.${{ env.DNSLINK_NAME }}\", + \"content\": \"dnslink=/ipfs/${{ env.DNSLINK_CID }}\", \"comment\": \"${{ github.repository }}/${{ github.sha }}\" }" env: