Skip to content

create funding.json #200

create funding.json

create funding.json #200

name: Upload Builds to IPFS
# Controls when the workflow will run
on:
# Triggers the workflow on pull request events but only for the main branch
push:
branches:
- main
- core-*
pull_request:
branches:
- main
- core-*
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job
upload-to-ipfs:
# The type of runner that the job will run on
runs-on: ubuntu-latest
environment: Buildship # environment to fetch secrets from
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache npm dependencies
id: cache-npm-deps
uses: actions/cache@v3
with:
# we cache node_modules directly, it may have downsides, but much faster
# https://www.voorhoede.nl/en/blog/super-fast-npm-install-on-github-actions/#fn1
path: ./node_modules
key: modules-${{ hashFiles('package-lock.json') }}
- name: Install Dependencies
if: steps.cache-npm-deps.outputs.cache-hit != 'true'
run: npm ci --ignore-scripts
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Run Forge build
run: |
forge --version
forge build --sizes
id: build
- name: Get changed contracts
id: changed-files-specific
uses: tj-actions/changed-files@v34
with:
files: |
contracts/**
- name: Build changed contracts and upload to IPFS
if: steps.changed-files-specific.outputs.any_changed == 'true'
id: build-ipfs
env:
NFT_STORAGE_API_KEY: ${{ secrets.NFT_STORAGE_API_KEY }}
run: |
echo "One or more files in the docs folder has changed."
echo "List all the files that have changed: ${{ steps.changed-files-specific.outputs.all_changed_files }}"
for file in ${{ steps.changed-files-specific.outputs.all_changed_files }}; do
# take output of hardhat upload and output it as "url=..." to $GITHUB_OUTPUT
npx hardhat upload $file | tail -n 1 > temp.txt
echo url="$(cat temp.txt)" >> $GITHUB_OUTPUT
done
- name: Show checks with IPFS links
uses: LouisBrunner/[email protected]
if: steps.changed-files-specific.outputs.any_changed == 'true'
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: IPFS Builds Uploads
conclusion: ${{ job.status }}
details_url: ${{ steps.build-ipfs.outputs.stdout }}
action_url: ${{ steps.build-ipfs.outputs.stdout }}
output: |
{"summary":"Uploaded! 🎉","text_description":"${{ steps.build-ipfs.outputs.url }}"}
- name: Create comment with IPFS links
if: steps.changed-files-specific.outputs.any_changed == 'true'
uses: actions/[email protected]
with:
# comment on current pull request using Github API
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "Deploy: ${{steps.build-ipfs.outputs.url}}"
})