Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add IPFS upload support #27

Merged
merged 14 commits into from
Oct 7, 2021
38 changes: 38 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI

on:
pull_request:

jobs:
deploy_ipfs:
runs-on: ubuntu-latest
container: node:14
env:
REACT_APP_SUPPORTED_ETHEREUM_NETWORKS: 'kovan,mumbai,fuji,mainnet,polygon,avalanche'
REACT_APP_DEFAULT_ETHEREUM_NETWORK: 'mainnet'
REACT_APP_ENABLE_CACHING_BACKEND: 'true'
REACT_APP_RATES_HISTORY_ENDPOINT: 'https://aave-api-v2.aave.com/data/rates-history'
NGINX_MODE: 'staging'
steps:
- uses: actions/checkout@v2

- name: install
run: npm ci

- name: Build and pinata upload
id: deploy
env:
PINATA_API_KEY: ${{ secrets.PINATA_API_KEY }}
PINATA_SECRET_KEY: ${{ secrets.PINATA_SECRET_KEY }}
PIN_ALIAS: "${{ format('pull_request_{0}', github.head_ref) }}"
run: npm run pinata:ipfs-publish

- uses: actions/github-script@v5
with:
script: |
github.rest.issues.createComment({
issue_number: context.payload.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Preview link: ${{steps.deploy.outputs.uri}}'
})
21 changes: 21 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"@0x/subproviders": "^6.5.4",
"@aave/aave-ui-kit": "^0.1.11",
"@aave/protocol-js": "^4.1.0",
"@actions/core": "^1.6.0",
"@apollo/client": "^3.4.8",
"@apollo/react-common": "^3.1.4",
"@gnosis.pm/safe-apps-web3-react": "^0.6.2",
Expand Down
2 changes: 1 addition & 1 deletion scripts/helpers/pinata.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const cleanupAndPin = async () => {
await pinata.testAuthentication();
console.log('Auth successful');

console.log('Cleaning up the previous pins');
console.log(`Cleaning up the previous pins for ${PIN_ALIAS}`);
try {
const previousPins = await pinata.pinList({
metadata: { name: PIN_ALIAS },
Expand Down
2 changes: 2 additions & 0 deletions scripts/publish.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
const core = require('@actions/core');
const updateCloudFlareRecord = require('./helpers/cloudflare');
const cleanupAndPin = require('./helpers/pinata');

async function pinAndPublish() {
const hash = await cleanupAndPin();
console.log(`Pinning was done successfully: https://cloudflare-ipfs.com/ipfs/${hash}`);
core.setOutput('uri', `https://cloudflare-ipfs.com/ipfs/${hash}`);

const domain = process.env.CF_DEPLOYMENT_DOMAIN;
if (domain) {
Expand Down