Skip to content

Commit

Permalink
chore(ci): additional pin to web3.storage
Browse files Browse the repository at this point in the history
porting setup from ipfs/ipfs-webui, with dedicated space/secrets
  • Loading branch information
lidel committed Mar 12, 2024
1 parent 1201b22 commit 364d95b
Showing 1 changed file with 50 additions and 2 deletions.
52 changes: 50 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}

0 comments on commit 364d95b

Please sign in to comment.