From ae1b08569adac1bbb8063bd456ad2720c87af920 Mon Sep 17 00:00:00 2001 From: Shahul Hameed Date: Mon, 23 Jan 2023 13:45:46 +0530 Subject: [PATCH 01/25] Try setting up heroku build --- Dockerfile | 21 +++++++++++++++++++++ heroku.yml | 3 +++ 2 files changed, 24 insertions(+) create mode 100644 Dockerfile create mode 100644 heroku.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..93de444f1d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM node:19-alpine + +# Install Git +RUN apk update +RUN apk add git + +# Copy files over +WORKDIR /app +COPY contracts ./contracts +COPY dapp ./dapp + +# Build contract files +WORKDIR /app/contracts +RUN yarn install +RUN yarn deploy + +# Build DApp +WORKDIR /app/dapp +RUN yarn build + +CMD ["yarn", "start"] diff --git a/heroku.yml b/heroku.yml new file mode 100644 index 0000000000..8eec25b9c9 --- /dev/null +++ b/heroku.yml @@ -0,0 +1,3 @@ +build: + docker: + web: Dockerfile From 314c8a576c4ea2dc77f0b7d187f5af10b8d0723d Mon Sep 17 00:00:00 2001 From: Shahul Hameed Date: Mon, 23 Jan 2023 13:48:17 +0530 Subject: [PATCH 02/25] Add root package.json for buildpack detection --- package.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 package.json diff --git a/package.json b/package.json new file mode 100644 index 0000000000..1491f4f1d7 --- /dev/null +++ b/package.json @@ -0,0 +1,7 @@ +{ + "name": "ousd", + "version": "0.1.0", + "description": "Origin Dollar", + "author": "Origin Protocol ", + "license": "MIT" +} \ No newline at end of file From 1e6c363816d4267d15e0dce42268ead8c59b1ae8 Mon Sep 17 00:00:00 2001 From: Shahul Hameed Date: Mon, 23 Jan 2023 13:54:41 +0530 Subject: [PATCH 03/25] Update Dockerfile --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 93de444f1d..1c83c31a0f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,8 @@ FROM node:19-alpine # Install Git RUN apk update RUN apk add git +git config --global --unset http.proxy +git config --global --unset https.proxy # Copy files over WORKDIR /app From 6e7e2bb3c38a109847d3eca587fcc1d5b9d5baff Mon Sep 17 00:00:00 2001 From: Shahul Hameed Date: Mon, 23 Jan 2023 13:55:21 +0530 Subject: [PATCH 04/25] Update Dockerfile --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1c83c31a0f..35c2cbc7e2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,8 +3,8 @@ FROM node:19-alpine # Install Git RUN apk update RUN apk add git -git config --global --unset http.proxy -git config --global --unset https.proxy +RUN git config --global --unset http.proxy +RUN git config --global --unset https.proxy # Copy files over WORKDIR /app From 146c9832e0621e44ab396bdd819c1c6afa5857a3 Mon Sep 17 00:00:00 2001 From: Shahul Hameed Date: Mon, 23 Jan 2023 13:59:18 +0530 Subject: [PATCH 05/25] Use Node.js v16 --- Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 35c2cbc7e2..9d3bbf1061 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,8 @@ -FROM node:19-alpine +FROM node:16-alpine # Install Git RUN apk update RUN apk add git -RUN git config --global --unset http.proxy -RUN git config --global --unset https.proxy # Copy files over WORKDIR /app From c2e0f66519d241a97016484215cc9de06c513e32 Mon Sep 17 00:00:00 2001 From: Shahul Hameed Date: Mon, 23 Jan 2023 14:29:46 +0530 Subject: [PATCH 06/25] Build docker images using Github actions --- .github/workflows/node.js.yml | 33 --------------------------------- .github/workflows/ousd.yml | 21 ++++++++++++++++++++- 2 files changed, 20 insertions(+), 34 deletions(-) delete mode 100644 .github/workflows/node.js.yml diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml deleted file mode 100644 index 2bec57f9d5..0000000000 --- a/.github/workflows/node.js.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Run tests -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [14.x] - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - name: Install dependencies - run: sudo apt update && sudo apt-get install -y libudev-dev libusb-1.0-0-dev - - run: yarn install - working-directory: ./contracts - - run: yarn run lint - working-directory: ./contracts - - run: yarn prettier:check - working-directory: ./contracts - - run: yarn run test - working-directory: ./contracts - - run: yarn install - working-directory: ./dapp - - run: yarn prettier:check - working-directory: ./dapp diff --git a/.github/workflows/ousd.yml b/.github/workflows/ousd.yml index 40417d290c..6032deb540 100644 --- a/.github/workflows/ousd.yml +++ b/.github/workflows/ousd.yml @@ -146,4 +146,23 @@ jobs: env: SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} with: - args: --severity-threshold=high --all-projects \ No newline at end of file + args: --severity-threshold=high --all-projects + + build-image: + name: "Build Image for Deployment" + runs-on: ubuntu-latest + env: + HEROKU_TOKEN: ${{ secrets.HEROKU_TOKEN }} + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Run Docker Login + run: docker login --username =_ --password=$(HEROKU_TOKEN) registry.heroku.com + - name: Build Image + uses: docker/build-push-action@v3 + with: + context: . + push: true + tag: registry.heroku.com/ousd-dapp-staging/web \ No newline at end of file From 877f4c61df54abc62593f804874246b8f1405e90 Mon Sep 17 00:00:00 2001 From: Shahul Hameed Date: Mon, 23 Jan 2023 14:32:34 +0530 Subject: [PATCH 07/25] Fix actions --- .github/workflows/ousd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ousd.yml b/.github/workflows/ousd.yml index 6032deb540..32227236ce 100644 --- a/.github/workflows/ousd.yml +++ b/.github/workflows/ousd.yml @@ -159,7 +159,7 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Run Docker Login - run: docker login --username =_ --password=$(HEROKU_TOKEN) registry.heroku.com + run: docker login --username =_ --password=$HEROKU_TOKEN registry.heroku.com - name: Build Image uses: docker/build-push-action@v3 with: From 934746517deeb8a72a1f2eec8d4ddd04cf2345a5 Mon Sep 17 00:00:00 2001 From: Shahul Hameed Date: Mon, 23 Jan 2023 14:33:41 +0530 Subject: [PATCH 08/25] Fix actions --- .github/workflows/ousd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ousd.yml b/.github/workflows/ousd.yml index 32227236ce..ae9fba49c7 100644 --- a/.github/workflows/ousd.yml +++ b/.github/workflows/ousd.yml @@ -165,4 +165,4 @@ jobs: with: context: . push: true - tag: registry.heroku.com/ousd-dapp-staging/web \ No newline at end of file + tags: registry.heroku.com/ousd-dapp-staging/web \ No newline at end of file From 1bb67c9617471add4bc0ff328c8ec0e5c353953f Mon Sep 17 00:00:00 2001 From: Shahul Hameed Date: Mon, 23 Jan 2023 14:35:47 +0530 Subject: [PATCH 09/25] Remove docker context --- .github/workflows/ousd.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ousd.yml b/.github/workflows/ousd.yml index ae9fba49c7..a6f4760381 100644 --- a/.github/workflows/ousd.yml +++ b/.github/workflows/ousd.yml @@ -163,6 +163,5 @@ jobs: - name: Build Image uses: docker/build-push-action@v3 with: - context: . push: true tags: registry.heroku.com/ousd-dapp-staging/web \ No newline at end of file From a8215faf7941fd75104d5b501840c28be0dac96b Mon Sep 17 00:00:00 2001 From: Shahul Hameed Date: Mon, 23 Jan 2023 14:48:15 +0530 Subject: [PATCH 10/25] Fix deps --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 9d3bbf1061..da32533d50 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,7 @@ RUN yarn deploy # Build DApp WORKDIR /app/dapp +RUN yarn install RUN yarn build CMD ["yarn", "start"] From 5d1de6dc6ae8fd12d9f5db1ba266d6c090ce84f4 Mon Sep 17 00:00:00 2001 From: Shahul Hameed Date: Mon, 23 Jan 2023 14:59:42 +0530 Subject: [PATCH 11/25] Fix push bug --- .github/workflows/ousd.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ousd.yml b/.github/workflows/ousd.yml index a6f4760381..5687ad4017 100644 --- a/.github/workflows/ousd.yml +++ b/.github/workflows/ousd.yml @@ -164,4 +164,5 @@ jobs: uses: docker/build-push-action@v3 with: push: true - tags: registry.heroku.com/ousd-dapp-staging/web \ No newline at end of file + tags: registry.heroku.com/ousd-dapp-staging/web + provenance: false \ No newline at end of file From 0e1defa5dd6e029c1f135e887690056d8efe61d9 Mon Sep 17 00:00:00 2001 From: Shahul Hameed Date: Mon, 23 Jan 2023 15:24:31 +0530 Subject: [PATCH 12/25] Fix port --- dapp/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dapp/package.json b/dapp/package.json index 1b0aff6814..67aad23be2 100644 --- a/dapp/package.json +++ b/dapp/package.json @@ -13,7 +13,7 @@ "ipfs-export": "DEPLOY_MODE=ipfs yarn run build && next export", "start": "per-env", "start:development": "NODE_ENV=development ETHEREUM_RPC_PROVIDER=http://localhost:8545 next dev", - "start:production": "NODE_ENV=production next start -p 8080", + "start:production": "NODE_ENV=production next start", "gcp-build": "next build", "encrypt-secrets:prod": "gcloud kms encrypt --ciphertext-file=prod.secrets.enc --plaintext-file=prod.env --location=global --keyring=origin --key=cloudbuild", "decrypt-secrets:prod": "gcloud kms decrypt --ciphertext-file=prod.secrets.enc --plaintext-file=prod.env --location=global --keyring=origin --key=cloudbuild", From eda53f2503bc52ddceb6831d5ee2018500333f67 Mon Sep 17 00:00:00 2001 From: Shahul Hameed Date: Mon, 23 Jan 2023 15:33:48 +0530 Subject: [PATCH 13/25] Fix port --- dapp/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dapp/package.json b/dapp/package.json index 67aad23be2..fcabc2bef1 100644 --- a/dapp/package.json +++ b/dapp/package.json @@ -13,7 +13,7 @@ "ipfs-export": "DEPLOY_MODE=ipfs yarn run build && next export", "start": "per-env", "start:development": "NODE_ENV=development ETHEREUM_RPC_PROVIDER=http://localhost:8545 next dev", - "start:production": "NODE_ENV=production next start", + "start:production": "NODE_ENV=production next start -p $PORT", "gcp-build": "next build", "encrypt-secrets:prod": "gcloud kms encrypt --ciphertext-file=prod.secrets.enc --plaintext-file=prod.env --location=global --keyring=origin --key=cloudbuild", "decrypt-secrets:prod": "gcloud kms decrypt --ciphertext-file=prod.secrets.enc --plaintext-file=prod.env --location=global --keyring=origin --key=cloudbuild", From a857c4c5814704ed1f2a76416878cbebd99d6d30 Mon Sep 17 00:00:00 2001 From: Shahul Hameed Date: Thu, 26 Jan 2023 20:23:06 +0530 Subject: [PATCH 14/25] Tweak image building step --- .github/workflows/ousd.yml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ousd.yml b/.github/workflows/ousd.yml index 5687ad4017..78b784dbd3 100644 --- a/.github/workflows/ousd.yml +++ b/.github/workflows/ousd.yml @@ -149,10 +149,14 @@ jobs: args: --severity-threshold=high --all-projects build-image: - name: "Build Image for Deployment" + name: "Build Release Image" runs-on: ubuntu-latest env: HEROKU_TOKEN: ${{ secrets.HEROKU_TOKEN }} + CURR_BRANCH: ${{ github.ref_name }} + with: + # TODO: Remove `shah/heroku-deploy` branch after merging PR + if: ${{ contains(fromJSON('["shah/heroku-deploy", "master", "staging", "stable"]'), github.ref_name) }} steps: - name: Set up QEMU uses: docker/setup-qemu-action@v2 @@ -160,9 +164,20 @@ jobs: uses: docker/setup-buildx-action@v2 - name: Run Docker Login run: docker login --username =_ --password=$HEROKU_TOKEN registry.heroku.com - - name: Build Image + - name: Identify Heroku App Name + shell: bash + run: + if [[ $CURR_BRANCH == "stable" ]]; then + echo "HEROKU_APP_NAME=ousd-dapp-prod" >> $GITHUB_ENV; + else + echo "HEROKU_APP_NAME=ousd-dapp-staging" >> $GITHUB_ENV; + fi; + id: heroku_app + - name: Build and Push uses: docker/build-push-action@v3 + # TODO: Remove `shah/heroku-deploy` branch after merging PR + if: ${{ contains(fromJSON('["shah/heroku-deploy", "staging", "stable"]'), github.ref_name) }} with: push: true - tags: registry.heroku.com/ousd-dapp-staging/web + tags: registry.heroku.com/${{env.HEROKU_APP_NAME}}/web provenance: false \ No newline at end of file From 4be64a0343c576e3be634406de3fb460089c7f64 Mon Sep 17 00:00:00 2001 From: Shahul Hameed Date: Thu, 26 Jan 2023 20:25:05 +0530 Subject: [PATCH 15/25] Fix workflow --- .github/workflows/ousd.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ousd.yml b/.github/workflows/ousd.yml index 78b784dbd3..873d3bffe5 100644 --- a/.github/workflows/ousd.yml +++ b/.github/workflows/ousd.yml @@ -154,7 +154,6 @@ jobs: env: HEROKU_TOKEN: ${{ secrets.HEROKU_TOKEN }} CURR_BRANCH: ${{ github.ref_name }} - with: # TODO: Remove `shah/heroku-deploy` branch after merging PR if: ${{ contains(fromJSON('["shah/heroku-deploy", "master", "staging", "stable"]'), github.ref_name) }} steps: From c0a9bd68d3411d7415922ae01c71f6d2ec89b583 Mon Sep 17 00:00:00 2001 From: Shahul Hameed Date: Thu, 26 Jan 2023 20:54:41 +0530 Subject: [PATCH 16/25] Deploy and push in Actions --- .github/workflows/ousd.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ousd.yml b/.github/workflows/ousd.yml index 873d3bffe5..c2a082f299 100644 --- a/.github/workflows/ousd.yml +++ b/.github/workflows/ousd.yml @@ -179,4 +179,15 @@ jobs: with: push: true tags: registry.heroku.com/${{env.HEROKU_APP_NAME}}/web - provenance: false \ No newline at end of file + provenance: false + - name: Heroku Login + uses: akhileshns/heroku-deploy@v3.12.12 + if: ${{ contains(fromJSON('["shah/heroku-deploy", "staging", "stable"]'), github.ref_name) }} + with: + justlogin: true + heroku_api_key: ${{secrets.HEROKU_TOKEN}} + heroku_app_name: ${{env.HEROKU_APP_NAME}} + heroku_email: ${{secrets.HEROKU_EMAIL}} + - name: Deploy + if: ${{ contains(fromJSON('["shah/heroku-deploy", "staging", "stable"]'), github.ref_name) }} + run: heroku container:release web \ No newline at end of file From db00b6ddaba69b8a8b9dfcad54f87b47cc0065c0 Mon Sep 17 00:00:00 2001 From: Shahul Hameed Date: Thu, 26 Jan 2023 21:10:40 +0530 Subject: [PATCH 17/25] Fix workflow --- .github/workflows/ousd.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ousd.yml b/.github/workflows/ousd.yml index c2a082f299..b97ca68f0f 100644 --- a/.github/workflows/ousd.yml +++ b/.github/workflows/ousd.yml @@ -188,6 +188,8 @@ jobs: heroku_api_key: ${{secrets.HEROKU_TOKEN}} heroku_app_name: ${{env.HEROKU_APP_NAME}} heroku_email: ${{secrets.HEROKU_EMAIL}} - - name: Deploy + - name: Deploy to Heroku if: ${{ contains(fromJSON('["shah/heroku-deploy", "staging", "stable"]'), github.ref_name) }} - run: heroku container:release web \ No newline at end of file + env: + HEROKU_APP_NAME: ${{env.HEROKU_APP_NAME}} + run: heroku container:release web -a $HEROKU_APP_NAME \ No newline at end of file From 662a14a131f1c2f3a937b29794ece9ce55d169b3 Mon Sep 17 00:00:00 2001 From: Shahul Hameed Date: Thu, 26 Jan 2023 21:22:46 +0530 Subject: [PATCH 18/25] Cleanup --- .github/workflows/ousd.yml | 4 +++- package.json | 7 ------- 2 files changed, 3 insertions(+), 8 deletions(-) delete mode 100644 package.json diff --git a/.github/workflows/ousd.yml b/.github/workflows/ousd.yml index b97ca68f0f..681474caf1 100644 --- a/.github/workflows/ousd.yml +++ b/.github/workflows/ousd.yml @@ -149,8 +149,10 @@ jobs: args: --severity-threshold=high --all-projects build-image: - name: "Build Release Image" + name: "Deploy App" runs-on: ubuntu-latest + # TODO: Add contracts-forktest when it's all green on master + needs: [contracts-lint, contracts-test, dapp-lint, slither] env: HEROKU_TOKEN: ${{ secrets.HEROKU_TOKEN }} CURR_BRANCH: ${{ github.ref_name }} diff --git a/package.json b/package.json deleted file mode 100644 index 1491f4f1d7..0000000000 --- a/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "ousd", - "version": "0.1.0", - "description": "Origin Dollar", - "author": "Origin Protocol ", - "license": "MIT" -} \ No newline at end of file From 96c66281cc13f4c6cc8863b4020b4c9e2981e4a6 Mon Sep 17 00:00:00 2001 From: Shahul Hameed Date: Thu, 26 Jan 2023 21:24:08 +0530 Subject: [PATCH 19/25] Remove unnecessary deps --- .github/workflows/ousd.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ousd.yml b/.github/workflows/ousd.yml index 681474caf1..0b1aa93259 100644 --- a/.github/workflows/ousd.yml +++ b/.github/workflows/ousd.yml @@ -151,8 +151,7 @@ jobs: build-image: name: "Deploy App" runs-on: ubuntu-latest - # TODO: Add contracts-forktest when it's all green on master - needs: [contracts-lint, contracts-test, dapp-lint, slither] + needs: [contracts-lint, dapp-lint] env: HEROKU_TOKEN: ${{ secrets.HEROKU_TOKEN }} CURR_BRANCH: ${{ github.ref_name }} From 2b156d91eaf46b01afa7d559429eb0eccd806e4c Mon Sep 17 00:00:00 2001 From: Shahul Hameed Date: Fri, 27 Jan 2023 08:12:00 +0530 Subject: [PATCH 20/25] Extract env before deploy --- .github/workflows/ousd.yml | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ousd.yml b/.github/workflows/ousd.yml index 0b1aa93259..cb0a9a0cc8 100644 --- a/.github/workflows/ousd.yml +++ b/.github/workflows/ousd.yml @@ -173,22 +173,29 @@ jobs: echo "HEROKU_APP_NAME=ousd-dapp-staging" >> $GITHUB_ENV; fi; id: heroku_app - - name: Build and Push - uses: docker/build-push-action@v3 - # TODO: Remove `shah/heroku-deploy` branch after merging PR - if: ${{ contains(fromJSON('["shah/heroku-deploy", "staging", "stable"]'), github.ref_name) }} - with: - push: true - tags: registry.heroku.com/${{env.HEROKU_APP_NAME}}/web - provenance: false - name: Heroku Login uses: akhileshns/heroku-deploy@v3.12.12 + # TODO: Remove `shah/heroku-deploy` branch after merging PR if: ${{ contains(fromJSON('["shah/heroku-deploy", "staging", "stable"]'), github.ref_name) }} with: justlogin: true heroku_api_key: ${{secrets.HEROKU_TOKEN}} heroku_app_name: ${{env.HEROKU_APP_NAME}} heroku_email: ${{secrets.HEROKU_EMAIL}} + - name: Extract Deployment Env + env: + HEROKU_APP_NAME: ${{env.HEROKU_APP_NAME}} + run: heroku config -s -a $HEROKU_APP_NAME > deploy.env + - name: Build and Push + uses: docker/build-push-action@v3 + # TODO: Remove `shah/heroku-deploy` branch after merging PR + if: ${{ contains(fromJSON('["shah/heroku-deploy", "staging", "stable"]'), github.ref_name) }} + env: + NODE_ENV: production + with: + push: true + tags: registry.heroku.com/${{env.HEROKU_APP_NAME}}/web + provenance: false - name: Deploy to Heroku if: ${{ contains(fromJSON('["shah/heroku-deploy", "staging", "stable"]'), github.ref_name) }} env: From f282b64aed644215776f0efc66c00485fc45db93 Mon Sep 17 00:00:00 2001 From: Shahul Hameed Date: Fri, 27 Jan 2023 08:15:41 +0530 Subject: [PATCH 21/25] Fix env path --- .github/workflows/ousd.yml | 2 +- Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ousd.yml b/.github/workflows/ousd.yml index cb0a9a0cc8..d88b9699af 100644 --- a/.github/workflows/ousd.yml +++ b/.github/workflows/ousd.yml @@ -185,7 +185,7 @@ jobs: - name: Extract Deployment Env env: HEROKU_APP_NAME: ${{env.HEROKU_APP_NAME}} - run: heroku config -s -a $HEROKU_APP_NAME > deploy.env + run: heroku config -s -a $HEROKU_APP_NAME > dapp/deploy.env - name: Build and Push uses: docker/build-push-action@v3 # TODO: Remove `shah/heroku-deploy` branch after merging PR diff --git a/Dockerfile b/Dockerfile index da32533d50..a0fd9dd5a0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,6 @@ RUN yarn deploy # Build DApp WORKDIR /app/dapp RUN yarn install -RUN yarn build +RUN NODE_ENV=production yarn build CMD ["yarn", "start"] From 6662d6d93d77e188d23d8b0eea048e7b888d442e Mon Sep 17 00:00:00 2001 From: Shahul Hameed Date: Fri, 27 Jan 2023 08:18:46 +0530 Subject: [PATCH 22/25] Fix path --- .github/workflows/ousd.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ousd.yml b/.github/workflows/ousd.yml index d88b9699af..a314b21b99 100644 --- a/.github/workflows/ousd.yml +++ b/.github/workflows/ousd.yml @@ -185,7 +185,8 @@ jobs: - name: Extract Deployment Env env: HEROKU_APP_NAME: ${{env.HEROKU_APP_NAME}} - run: heroku config -s -a $HEROKU_APP_NAME > dapp/deploy.env + working-directory: ./dapp + run: heroku config -s -a $HEROKU_APP_NAME > deploy.env - name: Build and Push uses: docker/build-push-action@v3 # TODO: Remove `shah/heroku-deploy` branch after merging PR From 23b57923c007f59a19d5006e1497590c36ae24eb Mon Sep 17 00:00:00 2001 From: Shahul Hameed Date: Fri, 27 Jan 2023 11:10:08 +0530 Subject: [PATCH 23/25] Checkout and change context --- .github/workflows/ousd.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ousd.yml b/.github/workflows/ousd.yml index a314b21b99..aa6bf548af 100644 --- a/.github/workflows/ousd.yml +++ b/.github/workflows/ousd.yml @@ -158,12 +158,17 @@ jobs: # TODO: Remove `shah/heroku-deploy` branch after merging PR if: ${{ contains(fromJSON('["shah/heroku-deploy", "master", "staging", "stable"]'), github.ref_name) }} steps: + - uses: actions/checkout@v3 + - name: Set up QEMU uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + - name: Run Docker Login run: docker login --username =_ --password=$HEROKU_TOKEN registry.heroku.com + - name: Identify Heroku App Name shell: bash run: @@ -173,6 +178,7 @@ jobs: echo "HEROKU_APP_NAME=ousd-dapp-staging" >> $GITHUB_ENV; fi; id: heroku_app + - name: Heroku Login uses: akhileshns/heroku-deploy@v3.12.12 # TODO: Remove `shah/heroku-deploy` branch after merging PR @@ -182,10 +188,11 @@ jobs: heroku_api_key: ${{secrets.HEROKU_TOKEN}} heroku_app_name: ${{env.HEROKU_APP_NAME}} heroku_email: ${{secrets.HEROKU_EMAIL}} + - name: Extract Deployment Env env: HEROKU_APP_NAME: ${{env.HEROKU_APP_NAME}} - working-directory: ./dapp + working-directory: dapp run: heroku config -s -a $HEROKU_APP_NAME > deploy.env - name: Build and Push uses: docker/build-push-action@v3 @@ -194,9 +201,11 @@ jobs: env: NODE_ENV: production with: + context: . push: true tags: registry.heroku.com/${{env.HEROKU_APP_NAME}}/web provenance: false + - name: Deploy to Heroku if: ${{ contains(fromJSON('["shah/heroku-deploy", "staging", "stable"]'), github.ref_name) }} env: From c7d0517e3997776b51d1991f7fd933ad499d1128 Mon Sep 17 00:00:00 2001 From: Shahul Hameed Date: Fri, 27 Jan 2023 11:21:34 +0530 Subject: [PATCH 24/25] Change Heroku app name --- .github/workflows/ousd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ousd.yml b/.github/workflows/ousd.yml index aa6bf548af..5f1359564b 100644 --- a/.github/workflows/ousd.yml +++ b/.github/workflows/ousd.yml @@ -173,7 +173,7 @@ jobs: shell: bash run: if [[ $CURR_BRANCH == "stable" ]]; then - echo "HEROKU_APP_NAME=ousd-dapp-prod" >> $GITHUB_ENV; + echo "HEROKU_APP_NAME=ousd-dapp" >> $GITHUB_ENV; else echo "HEROKU_APP_NAME=ousd-dapp-staging" >> $GITHUB_ENV; fi; From cb5ac0b3975178b453889cbe9cd9b59cfc8c395d Mon Sep 17 00:00:00 2001 From: Shahul Hameed Date: Fri, 27 Jan 2023 12:06:13 +0530 Subject: [PATCH 25/25] Remove references to local branch --- .github/workflows/ousd.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ousd.yml b/.github/workflows/ousd.yml index 5f1359564b..26d5b100a2 100644 --- a/.github/workflows/ousd.yml +++ b/.github/workflows/ousd.yml @@ -155,8 +155,7 @@ jobs: env: HEROKU_TOKEN: ${{ secrets.HEROKU_TOKEN }} CURR_BRANCH: ${{ github.ref_name }} - # TODO: Remove `shah/heroku-deploy` branch after merging PR - if: ${{ contains(fromJSON('["shah/heroku-deploy", "master", "staging", "stable"]'), github.ref_name) }} + if: ${{ contains(fromJSON('["master", "staging", "stable"]'), github.ref_name) }} steps: - uses: actions/checkout@v3 @@ -181,8 +180,7 @@ jobs: - name: Heroku Login uses: akhileshns/heroku-deploy@v3.12.12 - # TODO: Remove `shah/heroku-deploy` branch after merging PR - if: ${{ contains(fromJSON('["shah/heroku-deploy", "staging", "stable"]'), github.ref_name) }} + if: ${{ contains(fromJSON('["staging", "stable"]'), github.ref_name) }} with: justlogin: true heroku_api_key: ${{secrets.HEROKU_TOKEN}} @@ -196,8 +194,7 @@ jobs: run: heroku config -s -a $HEROKU_APP_NAME > deploy.env - name: Build and Push uses: docker/build-push-action@v3 - # TODO: Remove `shah/heroku-deploy` branch after merging PR - if: ${{ contains(fromJSON('["shah/heroku-deploy", "staging", "stable"]'), github.ref_name) }} + if: ${{ contains(fromJSON('["staging", "stable"]'), github.ref_name) }} env: NODE_ENV: production with: @@ -207,7 +204,7 @@ jobs: provenance: false - name: Deploy to Heroku - if: ${{ contains(fromJSON('["shah/heroku-deploy", "staging", "stable"]'), github.ref_name) }} + if: ${{ contains(fromJSON('["staging", "stable"]'), github.ref_name) }} env: HEROKU_APP_NAME: ${{env.HEROKU_APP_NAME}} run: heroku container:release web -a $HEROKU_APP_NAME \ No newline at end of file