From ec59511a69422eee60fbd2acffd76d100dd29f43 Mon Sep 17 00:00:00 2001 From: Nikita <45789684+qwolphin@users.noreply.github.com> Date: Wed, 6 Oct 2021 11:53:50 +0300 Subject: [PATCH 01/14] Create main.yml --- .github/workflows/main.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..aafe92552 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,19 @@ +name: CI + +on: + push: + branches: [ ipfs-upload ] + workflow_dispatch: + +jobs: + deploy_ipfs: + runs-on: node:13 + steps: + - uses: actions/checkout@v2 + - name: NPM + run: npm ci + - name: Build and pinata upload + env: + PINATA_API_KEY: ${{ secrets.PINATA_API_KEY }} + run: npm run pinata:ipfs-publish + From bf36351b5275ab1f9cc0ad325599f1b1c5d15ee0 Mon Sep 17 00:00:00 2001 From: sakulstra Date: Wed, 6 Oct 2021 11:19:49 +0200 Subject: [PATCH 02/14] fix: use ubuntu latest --- .github/workflows/main.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index aafe92552..413be0acf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,18 +2,23 @@ name: CI on: push: - branches: [ ipfs-upload ] + branches: [ipfs-upload] workflow_dispatch: jobs: deploy_ipfs: - runs-on: node:13 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: NPM + - uses: actions/setup-node@v2 + with: + node-version: '14' + cache: 'npm' + + - name: install run: npm ci + - name: Build and pinata upload env: PINATA_API_KEY: ${{ secrets.PINATA_API_KEY }} run: npm run pinata:ipfs-publish - From 29ed1600d76d586aefa94deec751e21b1896a223 Mon Sep 17 00:00:00 2001 From: Nikita <45789684+qwolphin@users.noreply.github.com> Date: Wed, 6 Oct 2021 12:36:07 +0300 Subject: [PATCH 03/14] Update main.yml --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 413be0acf..086e8c543 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,4 +21,5 @@ jobs: - name: Build and pinata upload env: PINATA_API_KEY: ${{ secrets.PINATA_API_KEY }} + PINATA_SECRET_KEY: ${{ secrets.PINATA_SECRET_KEY }} run: npm run pinata:ipfs-publish From b51cb48db7ce9c9fc798c8086e969021fdb2ec5c Mon Sep 17 00:00:00 2001 From: sakulstra Date: Wed, 6 Oct 2021 12:05:44 +0200 Subject: [PATCH 04/14] fix: add ipfs comment --- .github/workflows/main.yml | 15 +++++++++++++++ scripts/publish.js | 2 ++ 2 files changed, 17 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 086e8c543..9f8e3509c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,7 +19,22 @@ jobs: 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 }} run: npm run pinata:ipfs-publish + + - uses: actions/github-script@v4 + if: | + github.event.pull_request.head.repo.full_name == github.repository && + !contains(github.head_ref, 'dependabot') && + github.ref != 'refs/heads/master' + with: + script: | + github.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: 'Preview link: ${{steps.deploy.outputs.uri}}' + }) diff --git a/scripts/publish.js b/scripts/publish.js index 81f85968f..2e6eb1a38 100644 --- a/scripts/publish.js +++ b/scripts/publish.js @@ -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) { From 4e789d661a46303c2b84ef5e345450b359a9212f Mon Sep 17 00:00:00 2001 From: sakulstra Date: Wed, 6 Oct 2021 12:14:37 +0200 Subject: [PATCH 05/14] fix: add actions/core --- .github/workflows/main.yml | 2 ++ package-lock.json | 21 +++++++++++++++++++++ package.json | 1 + 3 files changed, 24 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9f8e3509c..645f26325 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,8 +4,10 @@ on: push: branches: [ipfs-upload] workflow_dispatch: + # pull_request: jobs: + if: "!contains(github.event.head_commit.message, '[ci skip]')" deploy_ipfs: runs-on: ubuntu-latest steps: diff --git a/package-lock.json b/package-lock.json index a59380dcf..53e753f23 100644 --- a/package-lock.json +++ b/package-lock.json @@ -420,6 +420,22 @@ "standard-version": "^9.1.0" } }, + "@actions/core": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.6.0.tgz", + "integrity": "sha512-NB1UAZomZlCV/LmJqkLhNTqtKfFXJZAUPcfl/zqG7EfsQdeUJtaWO98SGbuQ3pydJ3fHl2CvI/51OKYlCYYcaw==", + "requires": { + "@actions/http-client": "^1.0.11" + } + }, + "@actions/http-client": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz", + "integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==", + "requires": { + "tunnel": "0.0.6" + } + }, "@apollo/client": { "version": "3.4.8", "resolved": "https://registry.npmjs.org/@apollo/client/-/client-3.4.8.tgz", @@ -41313,6 +41329,11 @@ "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=" }, + "tunnel": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", + "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==" + }, "tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", diff --git a/package.json b/package.json index 3b610e667..cf6c966da 100644 --- a/package.json +++ b/package.json @@ -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", From e7a3d0fa47d1fc960db355c4ac1f28b4eed0fd3f Mon Sep 17 00:00:00 2001 From: sakulstra Date: Wed, 6 Oct 2021 12:17:03 +0200 Subject: [PATCH 06/14] fix: fix yaml file --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 645f26325..c7caedbd9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,8 +7,8 @@ on: # pull_request: jobs: - if: "!contains(github.event.head_commit.message, '[ci skip]')" deploy_ipfs: + if: "!contains(github.event.head_commit.message, '[ci skip]')" runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 From dba43ba190c5b493765417443daec27a4b6b88c8 Mon Sep 17 00:00:00 2001 From: sakulstra Date: Wed, 6 Oct 2021 12:30:11 +0200 Subject: [PATCH 07/14] fix: remove branch rules --- .github/workflows/main.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c7caedbd9..b91211d2d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,10 +28,6 @@ jobs: run: npm run pinata:ipfs-publish - uses: actions/github-script@v4 - if: | - github.event.pull_request.head.repo.full_name == github.repository && - !contains(github.head_ref, 'dependabot') && - github.ref != 'refs/heads/master' with: script: | github.issues.createComment({ From 2eb6946465df36427f63177c6069482cacd1142a Mon Sep 17 00:00:00 2001 From: sakulstra Date: Wed, 6 Oct 2021 12:47:56 +0200 Subject: [PATCH 08/14] fix: use correct pr number --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b91211d2d..f6454e015 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,11 +27,11 @@ jobs: PINATA_SECRET_KEY: ${{ secrets.PINATA_SECRET_KEY }} run: npm run pinata:ipfs-publish - - uses: actions/github-script@v4 + - uses: actions/github-script@v5 with: script: | - github.issues.createComment({ - issue_number: context.issue.number, + github.rest.issues.createComment({ + issue_number: github.event.number, owner: context.repo.owner, repo: context.repo.repo, body: 'Preview link: ${{steps.deploy.outputs.uri}}' From 52d39856bb98868de45f1cd5707a43f054afd895 Mon Sep 17 00:00:00 2001 From: sakulstra Date: Wed, 6 Oct 2021 12:53:16 +0200 Subject: [PATCH 09/14] fix: remove comment --- .github/workflows/main.yml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f6454e015..6ee5d715d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,6 +16,8 @@ jobs: with: node-version: '14' cache: 'npm' + - uses: jwalton/gh-find-current-pr@v1 + id: findPr - name: install run: npm ci @@ -27,12 +29,12 @@ jobs: PINATA_SECRET_KEY: ${{ secrets.PINATA_SECRET_KEY }} run: npm run pinata:ipfs-publish - - uses: actions/github-script@v5 - with: - script: | - github.rest.issues.createComment({ - issue_number: github.event.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: 'Preview link: ${{steps.deploy.outputs.uri}}' - }) + #- uses: actions/github-script@v5 + # with: + # script: | + # github.rest.issues.createComment({ + # issue_number: github.event.number, + # owner: context.repo.owner, + # repo: context.repo.repo, + # body: 'Preview link: ${{steps.deploy.outputs.uri}}' + # }) From d5ae705d705361808997d7d0fc3cdec93aa807e6 Mon Sep 17 00:00:00 2001 From: Lukas Strassel Date: Wed, 6 Oct 2021 13:13:38 +0200 Subject: [PATCH 10/14] fix: preview link comments (#29) add review link comments --- .github/workflows/main.yml | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6ee5d715d..ad98cf47f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,10 +1,7 @@ name: CI on: - push: - branches: [ipfs-upload] - workflow_dispatch: - # pull_request: + pull_request: jobs: deploy_ipfs: @@ -16,8 +13,6 @@ jobs: with: node-version: '14' cache: 'npm' - - uses: jwalton/gh-find-current-pr@v1 - id: findPr - name: install run: npm ci @@ -29,12 +24,12 @@ jobs: PINATA_SECRET_KEY: ${{ secrets.PINATA_SECRET_KEY }} run: npm run pinata:ipfs-publish - #- uses: actions/github-script@v5 - # with: - # script: | - # github.rest.issues.createComment({ - # issue_number: github.event.number, - # owner: context.repo.owner, - # repo: context.repo.repo, - # body: 'Preview link: ${{steps.deploy.outputs.uri}}' - # }) + - 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}}' + }) From 23ccaf776e1e12b2d1fac39797b3bbc1dc38c5f0 Mon Sep 17 00:00:00 2001 From: Wolphin Date: Thu, 7 Oct 2021 03:59:44 +0300 Subject: [PATCH 11/14] [ci skip] test skip --- .github/workflows/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ad98cf47f..871047ca9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,7 +5,6 @@ on: jobs: deploy_ipfs: - if: "!contains(github.event.head_commit.message, '[ci skip]')" runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 From 7c071558fce0637a886118718cadeb1df3823803 Mon Sep 17 00:00:00 2001 From: Wolphin Date: Thu, 7 Oct 2021 05:19:25 +0300 Subject: [PATCH 12/14] Avoid pin busting --- .github/workflows/main.yml | 6 ++---- scripts/helpers/pinata.js | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 871047ca9..364373693 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,12 +6,9 @@ on: jobs: deploy_ipfs: runs-on: ubuntu-latest + container: node:14 steps: - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: '14' - cache: 'npm' - name: install run: npm ci @@ -21,6 +18,7 @@ jobs: 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 diff --git a/scripts/helpers/pinata.js b/scripts/helpers/pinata.js index d1af26485..cfdfd6e4d 100644 --- a/scripts/helpers/pinata.js +++ b/scripts/helpers/pinata.js @@ -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 }, From 270f9227dcb4de4417158a74bd45c4467d2e1a5d Mon Sep 17 00:00:00 2001 From: Wolphin Date: Thu, 7 Oct 2021 05:26:25 +0300 Subject: [PATCH 13/14] Add build values --- .github/workflows/main.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 364373693..01f6e7ac8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,6 +7,14 @@ jobs: deploy_ipfs: runs-on: ubuntu-latest container: node:14 + env: + REACT_APP_SUPPORTED_ETHEREUM_NETWORKS: 'mumbai,kovan,mainnet,polygon,fuji,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' + REACT_APP_PERMISSIONS_API: 'https://aave-api-v2.aave.com' + NGINX_MODE: 'staging' + REACT_APP_ENABLE_NASH: 'true' steps: - uses: actions/checkout@v2 From ac635894218d7dea6bc2d38ec7b65804d62236f1 Mon Sep 17 00:00:00 2001 From: Nikita <45789684+qwolphin@users.noreply.github.com> Date: Thu, 7 Oct 2021 14:11:16 +0300 Subject: [PATCH 14/14] Apply suggestions from code review Co-authored-by: Lukas Strassel --- .github/workflows/main.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 01f6e7ac8..adcd5ff2d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,13 +8,11 @@ jobs: runs-on: ubuntu-latest container: node:14 env: - REACT_APP_SUPPORTED_ETHEREUM_NETWORKS: 'mumbai,kovan,mainnet,polygon,fuji,avalanche' + 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' - REACT_APP_PERMISSIONS_API: 'https://aave-api-v2.aave.com' NGINX_MODE: 'staging' - REACT_APP_ENABLE_NASH: 'true' steps: - uses: actions/checkout@v2