Merge pull request #96 from centrifuge/archive-flag-for-cent-app #225
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: | |
# For non-main branches, only push to IPFS so we can test it | |
push: | |
runs-on: ubuntu-latest | |
if: github.ref != 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 12.x | |
- run: npm run prepublish | |
- name: Upload to IPFS | |
id: upload_to_ipfs | |
uses: aquiladev/[email protected] | |
with: | |
path: ./out/pools.json | |
service: pinata | |
pinataPinName: mainnet-pools-$GITHUB_SHA | |
pinataKey: ${{ secrets.PINATA_KEY }} | |
pinataSecret: ${{ secrets.PINATA_SECRET }} | |
# For the main branch, push to IPFS and create a release | |
release: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 12.x | |
- run: npm run prepublish | |
- name: Upload to IPFS | |
id: upload_to_ipfs | |
uses: aquiladev/[email protected] | |
with: | |
path: ./out/pools.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 | |
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 | |
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/pools.json | |
asset_name: pools.json | |
asset_content_type: application/json |