-
Notifications
You must be signed in to change notification settings - Fork 2
83 lines (76 loc) · 2.5 KB
/
publish_to_ipfs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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