Merge pull request #3 from ipfs/publish-succeess #46
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy to IPFS | |
# Explicitly declare permissions | |
permissions: | |
contents: read | |
pull-requests: write | |
statuses: write | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true # Cancel in progress runs if a new run is started | |
jobs: | |
build-and-deploy: | |
uses: ./.github/workflows/ipfs-deploy.yml | |
with: | |
node-version: '20' | |
kubo-version: 'v0.33.0-rc3' | |
build-command: 'npm run build' | |
build-output-dir: 'out' | |
pinata: true | |
secrets: | |
STORACHA_KEY: ${{ secrets.STORACHA_KEY }} | |
STORACHA_PROOF: ${{ secrets.STORACHA_PROOF }} | |
PINATA_JWT_TOKEN: ${{ secrets.PINATA_JWT_TOKEN }} | |
update-dnslink: | |
runs-on: 'ubuntu-latest' | |
needs: build-and-deploy | |
if: github.ref == 'refs/heads/main' # only update for main branch | |
steps: | |
- name: Update DNSLink | |
run: | | |
echo "Updating DNSLink for: ${{ env.DNSLINK_NAME }}" | |
curl --request PUT \ | |
--header "Authorization: Bearer ${AUTH_TOKEN}" \ | |
--header 'Content-Type: application/json' \ | |
--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}\", | |
\"comment\": \"${{ github.repository }}/${{ github.sha }}\" | |
}" | |
env: | |
DNSLINK_NAME: 'ipns.ipfs.network' | |
DNSLINK_CID: ${{ needs.build-and-deploy.outputs.cid }} | |
ZONE_ID: ${{ secrets.CF_IPNS_NETWORK_ZONE_ID }} | |
RECORD_ID: ${{ secrets.CF_IPNS_NETWORK_RECORD_ID }} | |
AUTH_TOKEN: ${{ secrets.CF_IPNS_NETWORK_AUTH_TOKEN }} |