This commit is contained in:
Manish Gupta 2023-11-07 14:40:06 +05:30
parent 9cf171c099
commit 3668b1cc16

View File

@ -18,7 +18,8 @@ on:
env: env:
gh_branch: ${{ github.ref_name }} gh_branch: ${{ github.ref_name }}
img_tag: latest gh_t_branch: ${{ github.event.pull_request.base.ref }}
jobs: jobs:
branch_build_and_push: branch_build_and_push:
@ -29,11 +30,20 @@ jobs:
steps: steps:
- name: Check out the repo - name: Check out the repo
uses: actions/checkout@v3.3.0 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 - uses: ASzc/change-string-case-action@v2
id: gh_branch_upper_lower id: gh_branch_upper_lower
with: with:
string: ${{ env.gh_branch }} string: $TRG_BRANCH
# string: ${{ env.gh_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 +99,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