diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7b9f257d..6892f731 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -165,10 +165,10 @@ jobs: publish-to-ipfs: # TODO: make this run also on release - if: github.ref == 'refs/heads/main' + # TODO if: github.ref == 'refs/heads/main' needs: build runs-on: ubuntu-latest - environment: Deploy # dependency on 'Deploy' env means 'publish-to-ipfs' only runs when it is present + environment: Deploy # CF and Clusteer secrets concurrency: # only one job runs at a time == DNSLinks are updated in-order group: ${{ github.workflow }}-${{ github.ref }} @@ -272,3 +272,51 @@ jobs: ZONE_ID: ${{ secrets.CF_INBROWSERLINK_ZONE_ID }} RECORD_ID: ${{ secrets.CF_INBROWSERLINK_RECORD_ID }} AUTH_TOKEN: ${{ secrets.CF_INBROWSERLINK_AUTH_TOKEN }} + + smoke-test--http: + # TODO: make this run also on release + # TODO if: github.ref == 'refs/heads/main' + needs: publish-to-ipfs + runs-on: ubuntu-latest + steps: + - name: Smoke-test /ipfs-sw-main.js at inbrowser.link + run: curl --retry 3 --retry-delay 61 -s -D - -o /dev/null https://inbrowser.link/ipfs-sw-main.js + - name: Smoke-test /ipfs-sw-main.js at inbrowser.dev + run: curl --retry 3 --retry-delay 61 -s -D - -o /dev/null https://inbrowser.dev/ipfs-sw-main.js + + pin-to-w3: # ported from ipfs/ipfs-webui + # TODO: make this run also on release + # TODO if: github.ref == 'refs/heads/main' + needs: publish-to-ipfs + runs-on: ubuntu-latest + environment: web3.storage + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: lts/* + - name: Retrieve CAR produced by publish-to-ipfs job + uses: actions/download-artifact@v4 + with: + name: dist_${{ github.sha }}.car + run: | + # ensure whoami + npx -y --package=@web3-storage/w3cli@latest -- w3 whoami + + # convert base64 env var to file + echo $W3CLI_SPACE_DELEGATION_PROOF_BASE64_STRING | base64 -d > ipfs-webui-ci-space.ucan.proof + + # Add space + export W3CLI_SPACE_DID=$(npx -y --package=@web3-storage/w3cli@latest -- w3 space add ipfs-webui-ci-space.ucan.proof) + + # use space + npx -y --package=@web3-storage/w3cli@latest -- w3 space use $W3CLI_SPACE_DID + + # upload car + npx -y --package=@web3-storage/w3cli@latest -- w3 up --no-wrap --car dist_${{ github.sha }}.car + env: + W3_STORE_NAME: ${{ secrets.W3_STORE_NAME }} + W3_AGENT_DID: ${{ secrets.W3_AGENT_DID }} + # W3_PRINCIPAL env name is expected by w3cli tool: https://github.com/web3-storage/w3cli#w3_principal + W3_PRINCIPAL: ${{ secrets.W3_AGENT_PRINCIPAL }} + W3CLI_SPACE_DELEGATION_PROOF_BASE64_STRING: ${{ secrets.W3CLI_SPACE_DELEGATION_PROOF_BASE64_STRING }}