diff --git a/.github/workflows/hash-deploy-build.yml b/.github/workflows/hash-deploy-build.yml index 5c26ee4a..6549d750 100644 --- a/.github/workflows/hash-deploy-build.yml +++ b/.github/workflows/hash-deploy-build.yml @@ -26,17 +26,29 @@ jobs: - name: Build Production run: ./scripts/build-production.sh - - name: Upload to Storacha - id: upload - uses: storacha/add-to-web3@892505d8e70c79336721485e5500155c17a728e0 # v4 - with: - path_to_add: './dist' - secret_key: ${{ secrets.STORACHA_PRINCIPAL }} - proof: ${{ secrets.STORACHA_PROOF }} + - name: Install Kubo (IPFS CLI) + run: | + wget -q https://dist.ipfs.tech/kubo/v0.34.1/kubo_v0.34.1_linux-amd64.tar.gz + tar -xzf kubo_v0.34.1_linux-amd64.tar.gz + sudo cp kubo/ipfs /usr/local/bin/ + ipfs init --profile=badgerds + ipfs version + + - name: Generate IPFS Hash + id: ipfs + run: | + HASH=$(ipfs add -r -Q --chunker=size-262144 --raw-leaves=false ./dist) + HASH_V1=$(ipfs cid format -v 1 -b base32 $HASH) + + echo "hash_v0=$HASH" >> $GITHUB_OUTPUT + echo "hash_v1=$HASH_V1" >> $GITHUB_OUTPUT + + echo "IPFS Hash (v0): $HASH" + echo "IPFS Hash (v1): $HASH_V1" - name: Update IPFS Hash in Repo run: | - HASH="${{ steps.upload.outputs.cid }}" + HASH="${{ steps.ipfs.outputs.hash_v0 }}" # Create shields.io endpoint format JSON mkdir -p /tmp/ipfs-meta diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index 5d5c8f4a..e70481b1 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -14,7 +14,7 @@ jobs: id-token: write steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Setup Bun uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 @@ -28,7 +28,7 @@ jobs: run: bash ./scripts/build-development.sh - name: Setup Node - uses: actions/setup-node@v4 + uses: actions/setup-node@v5 with: node-version: "24" registry-url: "https://registry.npmjs.org" diff --git a/scripts/build-production.sh b/scripts/build-production.sh index c02e33af..d8307bdf 100755 --- a/scripts/build-production.sh +++ b/scripts/build-production.sh @@ -27,19 +27,26 @@ NODE_ENV=production OPENSCAN_COMMIT_HASH=$COMMIT_HASH npm run build echo "Production build completed!" echo "Build output is in ./dist/" -# Get IPFS hash (ensure consistent chunking) -ipfs add -r --chunker=size-262144 --raw-leaves=false ./dist -HASH=$(ipfs add -r -Q --chunker=size-262144 --raw-leaves=false ./dist) -HASH_V1=$(ipfs cid format -v 1 -b base32 $HASH) - -echo "IPFS Hash (v0): $HASH" -echo "IPFS Hash (v1): $HASH_V1" -echo "" -echo "IPFS URLs:" -echo " - https://ipfs.io/ipfs/$HASH" -echo " - https://cloudflare-ipfs.com/ipfs/$HASH" -echo " - https://gateway.ipfs.io/ipfs/$HASH" -echo "" -echo "IPFS v1 URLs:" -echo " - https://$HASH_V1.ipfs.dweb.link" -echo " - https://$HASH_V1.ipfs.cf-ipfs.com" +# Generate IPFS hash if ipfs CLI (Kubo) is available +if command -v ipfs &> /dev/null; then + echo "" + echo "Generating IPFS hash..." + HASH=$(ipfs add -r -Q --chunker=size-262144 --raw-leaves=false ./dist) + HASH_V1=$(ipfs cid format -v 1 -b base32 $HASH) + + echo "IPFS Hash (v0): $HASH" + echo "IPFS Hash (v1): $HASH_V1" + echo "" + echo "IPFS URLs:" + echo " - https://ipfs.io/ipfs/$HASH" + echo " - https://cloudflare-ipfs.com/ipfs/$HASH" + echo " - https://gateway.ipfs.io/ipfs/$HASH" + echo "" + echo "IPFS v1 URLs:" + echo " - https://$HASH_V1.ipfs.dweb.link" + echo " - https://$HASH_V1.ipfs.cf-ipfs.com" +else + echo "" + echo "IPFS CLI (Kubo) not found. Skipping hash generation." + echo "Install Kubo to generate IPFS hashes: https://docs.ipfs.tech/install/" +fi