From 81e6b43b77b6d654b9fdda9dbec2bbfddfa04397 Mon Sep 17 00:00:00 2001 From: Ari Rubinstein Date: Wed, 15 Feb 2023 16:23:01 -0800 Subject: [PATCH] feat: add a release when merged (#72) --- .github/workflows/deploy-inter.yml | 54 ++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 10 deletions(-) diff --git a/.github/workflows/deploy-inter.yml b/.github/workflows/deploy-inter.yml index 5ffea0c6..f8b4ab26 100644 --- a/.github/workflows/deploy-inter.yml +++ b/.github/workflows/deploy-inter.yml @@ -5,29 +5,34 @@ on: branches: [main] pull_request: workflow_dispatch: + inputs: + viteNetworkConfig: + type: string + required: false + default: '' + description: VITE Network config to pin. Blank == testing. e.g. netname.agoric.net jobs: - deploy: + build: runs-on: ubuntu-latest - permissions: - pull-requests: write steps: - name: Checkout uses: actions/checkout@v3 - - name: Get current date - id: date - run: echo "date=$(date +%Y-%m-%d_%H:%m:%S)" >> $GITHUB_OUTPUT - name: Use Node.js uses: actions/setup-node@v3 with: node-version: 18 - - name: Build run: | find . yarn install + if [[ "${{ inputs.viteNetworkConfig }}" != "" ]]; then + export VITE_NETWORK_CONFIG_URL=https://${{ inputs.viteNetworkConfig }}/network-config + fi yarn build - + - name: Get current date + id: date + run: echo "date=$(date +%Y-%m-%d_%H:%m:%S)" >> $GITHUB_OUTPUT - name: Deploy on IPFS uses: aquiladev/ipfs-action@12cc5d253735dc2894fe19828bd042c8532acc5d #v0.3.1 id: ipfs @@ -38,14 +43,43 @@ jobs: filebaseBucket: ${{ secrets.FILEBASE_BUCKET }} filebaseKey: ${{ secrets.FILEBASE_KEY }} filebaseSecret: ${{ secrets.FILEBASE_SECRET }} + outputs: + ipfs: ${{ steps.ipfs.outputs.ipfs }} + + annotate: + runs-on: ubuntu-latest + needs: build + permissions: + pull-requests: write + steps: - name: Convert IPFS Hash id: ipfsv1 run: | - echo "v1hash=$(npx --yes cid-tool@3.0.0 base32 ${{ steps.ipfs.outputs.ipfs }})" >> $GITHUB_OUTPUT + echo "v1hash=$(npx --yes cid-tool@3.0.0 base32 ${{ needs.build.outputs.ipfs }})" >> $GITHUB_OUTPUT - name: Add IPFS info to PR uses: mshick/add-pr-comment@a65df5f64fc741e91c59b8359a4bc56e57aaf5b1 #v2 with: message: | - IPFS hash: `${{ steps.ipfs.outputs.ipfs }}` + Network: ${{ inputs.viteNetworkConfig }} + Commit: ${{ github.sha }} + Ref: `${{ github.ref }}` IPFS v1 hash: `${{ steps.ipfsv1.outputs.v1hash }}` [CF](https://${{ steps.ipfsv1.outputs.v1hash }}.ipfs.cf-ipfs.com) - [DWeb](https://${{ steps.ipfsv1.outputs.v1hash }}.ipfs.dweb.link) - [4EVERLAND](https://${{ steps.ipfsv1.outputs.v1hash }}.ipfs.4everland.io) + outputs: + v1hash: ${{ steps.ipfsv1.outputs.v1hash }} + + release: + needs: annotate + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: softprops/action-gh-release@d4e8205d7e959a9107da6396278b2f1f07af0f9b + if: startsWith(github.ref, 'refs/tags/') + with: + body: | + Network: ${{ inputs.viteNetworkConfig }} + Commit: ${{ github.sha }} + Ref: `${{ github.ref }}` + IPFS v1 hash: `${{ needs.annotate.outputs.v1hash }}` + [CF](https://${{ needs.annotate.outputs.v1hash }}.ipfs.cf-ipfs.com) - [DWeb](https://${{ needs.annotate.outputs.v1hash }}.ipfs.dweb.link) - [4EVERLAND](https://${{ needs.annotate.outputs.v1hash }}.ipfs.4everland.io)