Skip to content

Commit 81e6b43

Browse files
feat: add a release when merged (#72)
1 parent bb5a1dd commit 81e6b43

File tree

1 file changed

+44
-10
lines changed

1 file changed

+44
-10
lines changed

.github/workflows/deploy-inter.yml

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,34 @@ on:
55
branches: [main]
66
pull_request:
77
workflow_dispatch:
8+
inputs:
9+
viteNetworkConfig:
10+
type: string
11+
required: false
12+
default: ''
13+
description: VITE Network config to pin. Blank == testing. e.g. netname.agoric.net
814

915
jobs:
10-
deploy:
16+
build:
1117
runs-on: ubuntu-latest
12-
permissions:
13-
pull-requests: write
1418
steps:
1519
- name: Checkout
1620
uses: actions/checkout@v3
17-
- name: Get current date
18-
id: date
19-
run: echo "date=$(date +%Y-%m-%d_%H:%m:%S)" >> $GITHUB_OUTPUT
2021
- name: Use Node.js
2122
uses: actions/setup-node@v3
2223
with:
2324
node-version: 18
24-
2525
- name: Build
2626
run: |
2727
find .
2828
yarn install
29+
if [[ "${{ inputs.viteNetworkConfig }}" != "" ]]; then
30+
export VITE_NETWORK_CONFIG_URL=https://${{ inputs.viteNetworkConfig }}/network-config
31+
fi
2932
yarn build
30-
33+
- name: Get current date
34+
id: date
35+
run: echo "date=$(date +%Y-%m-%d_%H:%m:%S)" >> $GITHUB_OUTPUT
3136
- name: Deploy on IPFS
3237
uses: aquiladev/ipfs-action@12cc5d253735dc2894fe19828bd042c8532acc5d #v0.3.1
3338
id: ipfs
@@ -38,14 +43,43 @@ jobs:
3843
filebaseBucket: ${{ secrets.FILEBASE_BUCKET }}
3944
filebaseKey: ${{ secrets.FILEBASE_KEY }}
4045
filebaseSecret: ${{ secrets.FILEBASE_SECRET }}
46+
outputs:
47+
ipfs: ${{ steps.ipfs.outputs.ipfs }}
48+
49+
annotate:
50+
runs-on: ubuntu-latest
51+
needs: build
52+
permissions:
53+
pull-requests: write
54+
steps:
4155
- name: Convert IPFS Hash
4256
id: ipfsv1
4357
run: |
44-
echo "v1hash=$(npx --yes [email protected] base32 ${{ steps.ipfs.outputs.ipfs }})" >> $GITHUB_OUTPUT
58+
echo "v1hash=$(npx --yes [email protected] base32 ${{ needs.build.outputs.ipfs }})" >> $GITHUB_OUTPUT
4559
- name: Add IPFS info to PR
4660
uses: mshick/add-pr-comment@a65df5f64fc741e91c59b8359a4bc56e57aaf5b1 #v2
4761
with:
4862
message: |
49-
IPFS hash: `${{ steps.ipfs.outputs.ipfs }}`
63+
Network: ${{ inputs.viteNetworkConfig }}
64+
Commit: ${{ github.sha }}
65+
Ref: `${{ github.ref }}`
5066
IPFS v1 hash: `${{ steps.ipfsv1.outputs.v1hash }}`
5167
[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)
68+
outputs:
69+
v1hash: ${{ steps.ipfsv1.outputs.v1hash }}
70+
71+
release:
72+
needs: annotate
73+
runs-on: ubuntu-latest
74+
permissions:
75+
contents: write
76+
steps:
77+
- uses: softprops/action-gh-release@d4e8205d7e959a9107da6396278b2f1f07af0f9b
78+
if: startsWith(github.ref, 'refs/tags/')
79+
with:
80+
body: |
81+
Network: ${{ inputs.viteNetworkConfig }}
82+
Commit: ${{ github.sha }}
83+
Ref: `${{ github.ref }}`
84+
IPFS v1 hash: `${{ needs.annotate.outputs.v1hash }}`
85+
[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)

0 commit comments

Comments
 (0)