From 71695cd81503d2dab0552c43241e1af6dc90e61c Mon Sep 17 00:00:00 2001 From: Martynas Prokopas Date: Thu, 27 Jan 2022 18:15:04 +0100 Subject: [PATCH 1/6] test build --- .github/workflows/ci-cd-test.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/ci-cd-test.yml diff --git a/.github/workflows/ci-cd-test.yml b/.github/workflows/ci-cd-test.yml new file mode 100644 index 000000000000..b2edf3c237d4 --- /dev/null +++ b/.github/workflows/ci-cd-test.yml @@ -0,0 +1,22 @@ +name: Pull Request CI/CD TEST + +on: + push: + branches: + - martynas/pull-request-cicd-fix + +env: + NEXT_PUBLIC_BASE_PATH: /docs + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout the repo + uses: actions/checkout@v2 + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: . # required to respect .dockerignore + push: false From edd8f5a66f8d9f4ac0263e3d02bd3a77b2dcbe25 Mon Sep 17 00:00:00 2001 From: Martynas Prokopas Date: Thu, 27 Jan 2022 18:18:48 +0100 Subject: [PATCH 2/6] try cache --- .github/workflows/ci-cd-test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-cd-test.yml b/.github/workflows/ci-cd-test.yml index b2edf3c237d4..d634b8a15ad9 100644 --- a/.github/workflows/ci-cd-test.yml +++ b/.github/workflows/ci-cd-test.yml @@ -6,6 +6,7 @@ on: - martynas/pull-request-cicd-fix env: + BASE_IMAGE: ghcr.io/graphprotocol/graph-docs-staging NEXT_PUBLIC_BASE_PATH: /docs jobs: @@ -15,8 +16,9 @@ jobs: - name: Checkout the repo uses: actions/checkout@v2 - - name: Build and push Docker image + - name: Build Docker image uses: docker/build-push-action@v2 with: context: . # required to respect .dockerignore + cache-from: type=registry,ref=${{ env.BASE_IMAGE }}:latest push: false From 062819aa13c2337f35b12c05f75769c8b9cd7278 Mon Sep 17 00:00:00 2001 From: Martynas Prokopas Date: Thu, 27 Jan 2022 18:20:44 +0100 Subject: [PATCH 3/6] use npm secret --- .github/workflows/ci-cd-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-cd-test.yml b/.github/workflows/ci-cd-test.yml index d634b8a15ad9..2929084e96ed 100644 --- a/.github/workflows/ci-cd-test.yml +++ b/.github/workflows/ci-cd-test.yml @@ -21,4 +21,5 @@ jobs: with: context: . # required to respect .dockerignore cache-from: type=registry,ref=${{ env.BASE_IMAGE }}:latest + secrets: npmrc=//registry.npmjs.org/:_authToken=${{ secrets.NPM_SECRET_TOKEN }} push: false From 48915d66f4737e92ba6b833ab4e5ba4739ecc54d Mon Sep 17 00:00:00 2001 From: Martynas Prokopas Date: Thu, 27 Jan 2022 18:23:01 +0100 Subject: [PATCH 4/6] use NEXT_PUBLIC_BASE_PATH --- .github/workflows/ci-cd-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-cd-test.yml b/.github/workflows/ci-cd-test.yml index 2929084e96ed..af5861a8ebe4 100644 --- a/.github/workflows/ci-cd-test.yml +++ b/.github/workflows/ci-cd-test.yml @@ -21,5 +21,5 @@ jobs: with: context: . # required to respect .dockerignore cache-from: type=registry,ref=${{ env.BASE_IMAGE }}:latest - secrets: npmrc=//registry.npmjs.org/:_authToken=${{ secrets.NPM_SECRET_TOKEN }} push: false + build-args: NEXT_PUBLIC_BASE_PATH=${{ env.NEXT_PUBLIC_BASE_PATH }} From a2dc1bc0c6d42465022b6f3b65a7ec6dccd2d184 Mon Sep 17 00:00:00 2001 From: Martynas Prokopas Date: Thu, 27 Jan 2022 18:26:51 +0100 Subject: [PATCH 5/6] remove secret from dockerfile --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0bf813172a0b..0ed4f495f504 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,8 +11,7 @@ COPY ./package.json /app/package.json COPY ./yarn.lock /app/yarn.lock # install the packages -RUN --mount=type=secret,id=npmrc,dst=/root/.npmrc \ - yarn install +RUN yarn install # copy the rest COPY . . From 40415f7ba7711b688c471d13ee6dd4ffc775151c Mon Sep 17 00:00:00 2001 From: Martynas Prokopas Date: Thu, 27 Jan 2022 18:27:39 +0100 Subject: [PATCH 6/6] remove test build --- .github/workflows/ci-cd-production.yml | 1 - .github/workflows/ci-cd-pull-request.yml | 18 ++--------------- .github/workflows/ci-cd-staging.yml | 1 - .github/workflows/ci-cd-test.yml | 25 ------------------------ 4 files changed, 2 insertions(+), 43 deletions(-) delete mode 100644 .github/workflows/ci-cd-test.yml diff --git a/.github/workflows/ci-cd-production.yml b/.github/workflows/ci-cd-production.yml index d8e7c3126d67..62f9239e6bf0 100644 --- a/.github/workflows/ci-cd-production.yml +++ b/.github/workflows/ci-cd-production.yml @@ -31,7 +31,6 @@ jobs: context: . # required to respect .dockerignore cache-from: type=registry,ref=${{ env.BASE_IMAGE }}:latest cache-to: type=inline - secrets: npmrc=//registry.npmjs.org/:_authToken=${{ secrets.NPM_SECRET_TOKEN }} tags: | ${{ env.BASE_IMAGE }}:${{ github.sha }} ${{ env.BASE_IMAGE }}:latest diff --git a/.github/workflows/ci-cd-pull-request.yml b/.github/workflows/ci-cd-pull-request.yml index 142cd5c753ae..13087055dedc 100644 --- a/.github/workflows/ci-cd-pull-request.yml +++ b/.github/workflows/ci-cd-pull-request.yml @@ -4,8 +4,6 @@ on: pull_request env: BASE_IMAGE: ghcr.io/graphprotocol/graph-docs-staging - HEALTH_CHECK_URL: https://staging.thegraph.com/docs - APP_NAME: graph-docs NEXT_PUBLIC_BASE_PATH: /docs jobs: @@ -15,22 +13,10 @@ jobs: - name: Checkout the repo uses: actions/checkout@v2 - - name: Login to GitHub Container Registry - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: nenadjaja - password: ${{ secrets.GH_ACCESS_TOKEN }} - - - name: Build and push Docker image + - name: Build Docker image uses: docker/build-push-action@v2 with: context: . # required to respect .dockerignore cache-from: type=registry,ref=${{ env.BASE_IMAGE }}:latest - cache-to: type=inline - secrets: npmrc=//registry.npmjs.org/:_authToken=${{ secrets.NPM_SECRET_TOKEN }} - tags: | - ${{ env.BASE_IMAGE }}:${{ github.sha }} - ${{ env.BASE_IMAGE }}:latest - push: true + push: false build-args: NEXT_PUBLIC_BASE_PATH=${{ env.NEXT_PUBLIC_BASE_PATH }} diff --git a/.github/workflows/ci-cd-staging.yml b/.github/workflows/ci-cd-staging.yml index c91525a1fe47..8789991c63d5 100644 --- a/.github/workflows/ci-cd-staging.yml +++ b/.github/workflows/ci-cd-staging.yml @@ -31,7 +31,6 @@ jobs: context: . # required to respect .dockerignore cache-from: type=registry,ref=${{ env.BASE_IMAGE }}:latest cache-to: type=inline - secrets: npmrc=//registry.npmjs.org/:_authToken=${{ secrets.NPM_SECRET_TOKEN }} tags: | ${{ env.BASE_IMAGE }}:${{ github.sha }} ${{ env.BASE_IMAGE }}:latest diff --git a/.github/workflows/ci-cd-test.yml b/.github/workflows/ci-cd-test.yml deleted file mode 100644 index af5861a8ebe4..000000000000 --- a/.github/workflows/ci-cd-test.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Pull Request CI/CD TEST - -on: - push: - branches: - - martynas/pull-request-cicd-fix - -env: - BASE_IMAGE: ghcr.io/graphprotocol/graph-docs-staging - NEXT_PUBLIC_BASE_PATH: /docs - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout the repo - uses: actions/checkout@v2 - - - name: Build Docker image - uses: docker/build-push-action@v2 - with: - context: . # required to respect .dockerignore - cache-from: type=registry,ref=${{ env.BASE_IMAGE }}:latest - push: false - build-args: NEXT_PUBLIC_BASE_PATH=${{ env.NEXT_PUBLIC_BASE_PATH }}