From 234ae3659ae34c8ce313817680c53027bb7f56e2 Mon Sep 17 00:00:00 2001 From: Vasco Santos Date: Tue, 26 Apr 2022 09:37:50 +0200 Subject: [PATCH] feat: website with dnslink publishing (#30) --- .github/workflows/website.yml | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 45a4acf..4de237c 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -71,6 +71,48 @@ jobs: with: name: ${{ matrix.browser }}-${{ matrix.os }}-test-results path: ${{ matrix.test_results_path }} + build: + name: Build & Add to IPFS + runs-on: ubuntu-latest + outputs: + cid: ${{ steps.ipfs.outputs.cid }} + steps: + - uses: actions/checkout@v2 + - uses: pnpm/action-setup@v2.0.1 + with: + version: 6.32.x + - uses: actions/setup-node@v2 + with: + cache: 'pnpm' + - run: pnpm install + - name: Run build + env: + # Fake environment vars required for build + NEXT_PUBLIC_ENV: dev + run: pnpm build:website + # Add the site to web3.storage, output the cid as `steps.ipfs.outputs.cid` + - name: Add to web3.storage + uses: web3-storage/add-to-web3@v2 + id: ipfs + with: + path_to_add: packages/website/out + web3_token: ${{ secrets.WEB3_TOKEN }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - run: echo ${{ steps.ipfs.outputs.url }} + + # Publish to the staging domain if it's a change on main 🚀 + deploy: + name: Deploy https://staging.nftstorage.link + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + needs: build + runs-on: ubuntu-latest + steps: + - run: npx dnslink-cloudflare --record staging --domain nftstorage.link --link /ipfs/${{ needs.build.outputs.cid }} + env: + CF_API_TOKEN: ${{ secrets.CF_GATEWAY_TOKEN }} + release: if: github.event_name == 'push' && github.ref == 'refs/heads/main' name: Release