Merge pull request #2694 from makeplane/dev/mg-branch-build-2

Dev/mg branch build 2
This commit is contained in:
Manish Gupta 2023-11-07 15:23:40 +05:30 committed by GitHub
commit ef3d3cc5de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,9 @@
name: Docker Branch Build name: Docker Branch Build
on: on:
# push:
# branches:
# - "*"
pull_request: pull_request:
types: types:
- opened - opened
@ -16,9 +19,9 @@ on:
tags: tags:
description: 'Dev/QA Builds' description: 'Dev/QA Builds'
env: env:
gh_branch: ${{ github.ref_name }} TARGET_BRANCH: ''
img_tag: latest
jobs: jobs:
branch_build_and_push: branch_build_and_push:
@ -30,10 +33,18 @@ jobs:
- name: Check out the repo - name: Check out the repo
uses: actions/checkout@v3.3.0 uses: actions/checkout@v3.3.0
- name: Set Target Branch Name on PR close
if: ${{ github.event_name == 'pull_request' && github.event.action =='closed' }}
run: echo "TARGET_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV
- name: Set Target Branch Name on other than PR close
if: ${{ github.event.action !='closed' }}
run: echo "TARGET_BRANCH=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
- uses: ASzc/change-string-case-action@v2 - uses: ASzc/change-string-case-action@v2
id: gh_branch_upper_lower id: gh_branch_upper_lower
with: with:
string: ${{ env.gh_branch }} string: ${{env.TARGET_BRANCH}}
- uses: mad9000/actions-find-and-replace-string@2 - uses: mad9000/actions-find-and-replace-string@2
id: gh_branch_replace_slash id: gh_branch_replace_slash
@ -89,95 +100,95 @@ jobs:
outputs: outputs:
gh_branch_name: ${{ steps.gh_branch_clean.outputs.value }} gh_branch_name: ${{ steps.gh_branch_clean.outputs.value }}
branch_build_push_frontend: # branch_build_push_frontend:
runs-on: ubuntu-20.04 # runs-on: ubuntu-20.04
needs: [ branch_build_and_push ] # needs: [ branch_build_and_push ]
steps: # steps:
- name: Set up Docker Buildx # - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.5.0 # uses: docker/setup-buildx-action@v2.5.0
- name: Login to Docker Hub # - name: Login to Docker Hub
uses: docker/login-action@v2.1.0 # uses: docker/login-action@v2.1.0
with: # with:
username: ${{ secrets.DOCKERHUB_USERNAME }} # username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} # password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Downloading Web Source Code # - name: Downloading Web Source Code
uses: actions/download-artifact@v3 # uses: actions/download-artifact@v3
with: # with:
name: web-src-code # name: web-src-code
- name: Build and Push Frontend to Docker Container Registry # - name: Build and Push Frontend to Docker Container Registry
uses: docker/build-push-action@v4.0.0 # uses: docker/build-push-action@v4.0.0
with: # with:
context: . # context: .
file: ./web/Dockerfile.web # file: ./web/Dockerfile.web
platforms: linux/amd64 # platforms: linux/amd64
tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-frontend-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} # tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-frontend-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }}
push: true # push: true
env: # env:
DOCKER_BUILDKIT: 1 # DOCKER_BUILDKIT: 1
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} # DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} # DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
branch_build_push_space: # branch_build_push_space:
runs-on: ubuntu-20.04 # runs-on: ubuntu-20.04
needs: [ branch_build_and_push ] # needs: [ branch_build_and_push ]
steps: # steps:
- name: Set up Docker Buildx # - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.5.0 # uses: docker/setup-buildx-action@v2.5.0
- name: Login to Docker Hub # - name: Login to Docker Hub
uses: docker/login-action@v2.1.0 # uses: docker/login-action@v2.1.0
with: # with:
username: ${{ secrets.DOCKERHUB_USERNAME }} # username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} # password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Downloading Space Source Code # - name: Downloading Space Source Code
uses: actions/download-artifact@v3 # uses: actions/download-artifact@v3
with: # with:
name: space-src-code # name: space-src-code
- name: Build and Push Space to Docker Hub # - name: Build and Push Space to Docker Hub
uses: docker/build-push-action@v4.0.0 # uses: docker/build-push-action@v4.0.0
with: # with:
context: . # context: .
file: ./space/Dockerfile.space # file: ./space/Dockerfile.space
platforms: linux/amd64 # platforms: linux/amd64
tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-space-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} # tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-space-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }}
push: true # push: true
env: # env:
DOCKER_BUILDKIT: 1 # DOCKER_BUILDKIT: 1
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} # DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} # DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
branch_build_push_backend: # branch_build_push_backend:
runs-on: ubuntu-20.04 # runs-on: ubuntu-20.04
needs: [ branch_build_and_push ] # needs: [ branch_build_and_push ]
steps: # steps:
- name: Set up Docker Buildx # - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.5.0 # uses: docker/setup-buildx-action@v2.5.0
- name: Login to Docker Hub # - name: Login to Docker Hub
uses: docker/login-action@v2.1.0 # uses: docker/login-action@v2.1.0
with: # with:
username: ${{ secrets.DOCKERHUB_USERNAME }} # username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} # password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Downloading Backend Source Code # - name: Downloading Backend Source Code
uses: actions/download-artifact@v3 # uses: actions/download-artifact@v3
with: # with:
name: backend-src-code # name: backend-src-code
- name: Build and Push Backend to Docker Hub # - name: Build and Push Backend to Docker Hub
uses: docker/build-push-action@v4.0.0 # uses: docker/build-push-action@v4.0.0
with: # with:
context: . # context: .
file: ./Dockerfile.api # file: ./Dockerfile.api
platforms: linux/amd64 # platforms: linux/amd64
push: true # push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-backend-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }} # tags: ${{ secrets.DOCKERHUB_USERNAME }}/plane-backend-private:${{ needs.branch_build_and_push.outputs.gh_branch_name }}
env: # env:
DOCKER_BUILDKIT: 1 # DOCKER_BUILDKIT: 1
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} # DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} # DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
branch_build_push_proxy: branch_build_push_proxy:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
@ -209,3 +220,4 @@ jobs:
DOCKER_BUILDKIT: 1 DOCKER_BUILDKIT: 1
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} DOCKET_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}