From 3668b1cc16bbbab30b60f8162f1f6f87fe1d5161 Mon Sep 17 00:00:00 2001 From: Manish Gupta Date: Tue, 7 Nov 2023 14:40:06 +0530 Subject: [PATCH] wip --- .github/workflows/build-branch.yml | 176 +++++++++++++++-------------- 1 file changed, 93 insertions(+), 83 deletions(-) diff --git a/.github/workflows/build-branch.yml b/.github/workflows/build-branch.yml index bf7ea19a9..9d43e9ae9 100644 --- a/.github/workflows/build-branch.yml +++ b/.github/workflows/build-branch.yml @@ -18,7 +18,8 @@ on: env: gh_branch: ${{ github.ref_name }} - img_tag: latest + gh_t_branch: ${{ github.event.pull_request.base.ref }} + jobs: branch_build_and_push: @@ -29,11 +30,20 @@ jobs: steps: - name: Check out the repo uses: actions/checkout@v3.3.0 + + - name: Set Environment Variable + run: | + if [ ${{ github.event_name }} == 'pull_request' ] && [ ${{github.event.action}} == 'closed' ] ; then + echo "::set-env name=TRG_BRANCH::${{github.event.pull_request.base.ref}}" + else + echo "::set-env name=TRG_BRANCH::${{github.ref_name}}" + fi - uses: ASzc/change-string-case-action@v2 id: gh_branch_upper_lower with: - string: ${{ env.gh_branch }} + string: $TRG_BRANCH + # string: ${{ env.gh_branch }} - uses: mad9000/actions-find-and-replace-string@2 id: gh_branch_replace_slash @@ -89,95 +99,95 @@ jobs: outputs: gh_branch_name: ${{ steps.gh_branch_clean.outputs.value }} - branch_build_push_frontend: - runs-on: ubuntu-20.04 - needs: [ branch_build_and_push ] - steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2.5.0 + # branch_build_push_frontend: + # runs-on: ubuntu-20.04 + # needs: [ branch_build_and_push ] + # steps: + # - name: Set up Docker Buildx + # uses: docker/setup-buildx-action@v2.5.0 - - name: Login to Docker Hub - uses: docker/login-action@v2.1.0 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Downloading Web Source Code - uses: actions/download-artifact@v3 - with: - name: web-src-code + # - name: Login to Docker Hub + # uses: docker/login-action@v2.1.0 + # with: + # username: ${{ secrets.DOCKERHUB_USERNAME }} + # password: ${{ secrets.DOCKERHUB_TOKEN }} + # - name: Downloading Web Source Code + # uses: actions/download-artifact@v3 + # with: + # name: web-src-code - - name: Build and Push Frontend to Docker Container Registry - uses: docker/build-push-action@v4.0.0 - with: - context: . - file: ./web/Dockerfile.web - platforms: linux/amd64 - tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-frontend-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} - push: true - env: - DOCKER_BUILDKIT: 1 - DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} + # - name: Build and Push Frontend to Docker Container Registry + # uses: docker/build-push-action@v4.0.0 + # with: + # context: . + # file: ./web/Dockerfile.web + # platforms: linux/amd64 + # tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-frontend-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} + # push: true + # env: + # DOCKER_BUILDKIT: 1 + # DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + # DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} - branch_build_push_space: - runs-on: ubuntu-20.04 - needs: [ branch_build_and_push ] - steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2.5.0 + # branch_build_push_space: + # runs-on: ubuntu-20.04 + # needs: [ branch_build_and_push ] + # steps: + # - name: Set up Docker Buildx + # uses: docker/setup-buildx-action@v2.5.0 - - name: Login to Docker Hub - uses: docker/login-action@v2.1.0 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Downloading Space Source Code - uses: actions/download-artifact@v3 - with: - name: space-src-code + # - name: Login to Docker Hub + # uses: docker/login-action@v2.1.0 + # with: + # username: ${{ secrets.DOCKERHUB_USERNAME }} + # password: ${{ secrets.DOCKERHUB_TOKEN }} + # - name: Downloading Space Source Code + # uses: actions/download-artifact@v3 + # with: + # name: space-src-code - - name: Build and Push Space to Docker Hub - uses: docker/build-push-action@v4.0.0 - with: - context: . - file: ./space/Dockerfile.space - platforms: linux/amd64 - tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-space-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} - push: true - env: - DOCKER_BUILDKIT: 1 - DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} + # - name: Build and Push Space to Docker Hub + # uses: docker/build-push-action@v4.0.0 + # with: + # context: . + # file: ./space/Dockerfile.space + # platforms: linux/amd64 + # tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-space-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} + # push: true + # env: + # DOCKER_BUILDKIT: 1 + # DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + # DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} - branch_build_push_backend: - runs-on: ubuntu-20.04 - needs: [ branch_build_and_push ] - steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2.5.0 + # branch_build_push_backend: + # runs-on: ubuntu-20.04 + # needs: [ branch_build_and_push ] + # steps: + # - name: Set up Docker Buildx + # uses: docker/setup-buildx-action@v2.5.0 - - name: Login to Docker Hub - uses: docker/login-action@v2.1.0 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Downloading Backend Source Code - uses: actions/download-artifact@v3 - with: - name: backend-src-code + # - name: Login to Docker Hub + # uses: docker/login-action@v2.1.0 + # with: + # username: ${{ secrets.DOCKERHUB_USERNAME }} + # password: ${{ secrets.DOCKERHUB_TOKEN }} + # - name: Downloading Backend Source Code + # uses: actions/download-artifact@v3 + # with: + # name: backend-src-code - - name: Build and Push Backend to Docker Hub - uses: docker/build-push-action@v4.0.0 - with: - context: . - file: ./Dockerfile.api - platforms: linux/amd64 - push: true - tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-backend-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} - env: - DOCKER_BUILDKIT: 1 - DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} + # - name: Build and Push Backend to Docker Hub + # uses: docker/build-push-action@v4.0.0 + # with: + # context: . + # file: ./Dockerfile.api + # platforms: linux/amd64 + # push: true + # tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-backend-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} + # env: + # DOCKER_BUILDKIT: 1 + # DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + # DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} branch_build_push_proxy: runs-on: ubuntu-20.04