ci: image parameterization via env variables #847
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy dapp-inter to IPFS | |
on: | |
push: | |
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: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- 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 | |
with: | |
path: ./dist | |
service: filebase | |
pinName: 'dapp-inter-testing-${{ steps.date.outputs.date }}-${{ github.sha }}-${{ github.run_id }}-${{ github.run_number }}' | |
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 [email protected] base32 ${{ needs.build.outputs.ipfs }})" >> $GITHUB_OUTPUT | |
- name: Add IPFS info to PR | |
uses: mshick/add-pr-comment@a65df5f64fc741e91c59b8359a4bc56e57aaf5b1 #v2 | |
with: | |
message: | | |
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 }} |