Add IPFS deployment #4
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: Publish contracts to IPFS | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 12.x | |
- run: | | |
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then | |
npm run prepublish | |
else | |
npm run prepublish | |
fi | |
- name: Upload to IPFS | |
id: upload_to_ipfs | |
uses: aquiladev/[email protected] | |
with: | |
path: ./out/prime.json | |
service: pinata | |
pinataPinName: mainnet-pools-$GITHUB_SHA | |
pinataKey: ${{ secrets.PINATA_KEY }} | |
pinataSecret: ${{ secrets.PINATA_SECRET }} | |
- id: vars | |
shell: bash | |
run: | | |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | |
- name: Create Release | |
if: github.ref == 'refs/heads/main' | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.vars.outputs.sha_short }} | |
release_name: Release ${{ steps.vars.outputs.sha_short }} | |
body: | | |
IPFS Hash: ${{ steps.upload_to_ipfs.outputs.hash }} | |
https://cloudflare-ipfs.com/ipfs/${{ steps.upload_to_ipfs.outputs.hash }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
if: github.ref == 'refs/heads/main' | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ./out/prime.json | |
asset_name: prime.json | |
asset_content_type: application/json |