|
| 1 | +name: Deploy ProtocolUI to dev |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + # allow manual run |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + bump_version: |
| 12 | + name: Bump Version |
| 13 | + runs-on: ubuntu-latest |
| 14 | + outputs: |
| 15 | + new_tag: ${{ steps.github_tag_action.outputs.new_tag }} |
| 16 | + changelog: ${{ steps.github_tag_action.outputs.changelog }} |
| 17 | + steps: |
| 18 | + - name: Checkout |
| 19 | + uses: actions/checkout@v2 |
| 20 | + |
| 21 | + - name: Bump version and push tag |
| 22 | + id: github_tag_action |
| 23 | + uses: mathieudutour/github-tag-action@v5.5 |
| 24 | + with: |
| 25 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 26 | + release_branches: release.*,master |
| 27 | + |
| 28 | + deploy: |
| 29 | + name: Deploy Release |
| 30 | + runs-on: ubuntu-latest |
| 31 | + needs: bump_version |
| 32 | + if: ${{ needs.bump_version.outputs.new_tag != null }} |
| 33 | + steps: |
| 34 | + # Basic env setup and app build |
| 35 | + # Result: built app in /dist |
| 36 | + - name: Checkout |
| 37 | + uses: actions/checkout@v2 |
| 38 | + - name: Load node v14 |
| 39 | + uses: actions/setup-node@v1 |
| 40 | + with: |
| 41 | + node-version: '14' |
| 42 | + - name: Install deps |
| 43 | + run: yarn install --frozen-lockfile |
| 44 | + - name: Build app |
| 45 | + run: yarn build |
| 46 | + |
| 47 | + # Pinning |
| 48 | + # Result: CIDv0 hash |
| 49 | + - name: Pin via Pinata |
| 50 | + id: upload |
| 51 | + uses: aquiladev/ipfs-action@v0.1.5 |
| 52 | + with: |
| 53 | + path: ./dist |
| 54 | + service: pinata |
| 55 | + pinataKey: ${{ secrets.PINATA_API_KEY }} |
| 56 | + pinataSecret: ${{ secrets.PINATA_API_SECRET }} |
| 57 | + pinataPinName: ${{ github.repository }} on ipfs |
| 58 | + |
| 59 | + # DNS |
| 60 | + - name: Display pin address |
| 61 | + run: | |
| 62 | + echo published as: https://dweb.link/ipfs/${{ steps.upload.outputs.hash }}/ and https://gateway.pinata.cloud/ipfs/${{ steps.upload.outputs.hash }}/ |
| 63 | +
|
| 64 | + - name: Update DNS with new IPFS hash |
| 65 | + env: |
| 66 | + CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }} |
| 67 | + CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }} |
| 68 | + RECORD_DOMAIN: ${{ secrets.CLOUDFLARE_DOMAIN }} |
| 69 | + RECORD_NAME: _dnslink.${{ secrets.CLOUDFLARE_SUBDOMAIN_DEV }} |
| 70 | + uses: textileio/cloudflare-update-dnslink@master |
| 71 | + with: |
| 72 | + cid: ${{ steps.upload.outputs.hash }} |
| 73 | + |
| 74 | + # GitHub release with links |
| 75 | + - name: Create GitHub Release with tag ${{ needs.bump_version.outputs.new_tag }} |
| 76 | + id: create_release |
| 77 | + uses: ncipollo/release-action@v1.8.4 |
| 78 | + env: |
| 79 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 80 | + with: |
| 81 | + tag: ${{ needs.bump_version.outputs.new_tag }} |
| 82 | + name: Release ${{ needs.bump_version.outputs.new_tag }} |
| 83 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 84 | + body: | |
| 85 | + IPFS hash of the deployment: |
| 86 | + - CIDv0: `${{ steps.upload.outputs.hash }}` |
| 87 | +
|
| 88 | + The latest release is always accessible via our alias to the Cloudflare IPFS gateway at [${{ secrets.CLOUDFLARE_SUBDOMAIN }}.${{ secrets.CLOUDFLARE_DOMAIN }}](https://${{ secrets.CLOUDFLARE_SUBDOMAIN }}.${{ secrets.CLOUDFLARE_DOMAIN }}). |
| 89 | +
|
| 90 | + IPFS gateways: |
| 91 | + - https://gateway.pinata.cloud/ipfs/${{ steps.upload.outputs.hash }}/ |
| 92 | + - https://cloudflare-ipfs.com/ipfs/${{ steps.upload.outputs.hash }}/ |
| 93 | + - https://ipfs.io/ipfs/${{ steps.upload.outputs.hash }}/ |
| 94 | + ${{ needs.bump_version.outputs.changelog }} |
0 commit comments