From d18bdc509c2ab6b670938aeee9aa8d2a002da0dd Mon Sep 17 00:00:00 2001 From: Manish Gupta Date: Wed, 26 Jun 2024 15:21:13 +0530 Subject: [PATCH] added app build --- .github/workflows/build-aio-base.yml | 57 --------- .github/workflows/build-aio-branch.yml | 164 +++++++++++++++++++++++++ 2 files changed, 164 insertions(+), 57 deletions(-) create mode 100644 .github/workflows/build-aio-branch.yml diff --git a/.github/workflows/build-aio-base.yml b/.github/workflows/build-aio-base.yml index 77cffc95452..694f155dd17 100644 --- a/.github/workflows/build-aio-base.yml +++ b/.github/workflows/build-aio-base.yml @@ -128,60 +128,3 @@ jobs: DOCKER_BUILDKIT: 1 DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} - - full_build_push: - runs-on: ubuntu-20.04 - needs: [base_build_setup, full_base_build_push] - env: - AIO_BASE_TAG: ${{ needs.base_build_setup.outputs.image_tag }} - AIO_IMAGE_TAGS: makeplane/plane-aio-app-full:${{ needs.base_build_setup.outputs.gh_branch_name }} - TARGET_BRANCH: ${{ needs.base_build_setup.outputs.gh_branch_name }} - BUILDX_DRIVER: ${{ needs.base_build_setup.outputs.gh_buildx_driver }} - BUILDX_VERSION: ${{ needs.base_build_setup.outputs.gh_buildx_version }} - BUILDX_PLATFORMS: ${{ needs.base_build_setup.outputs.gh_buildx_platforms }} - BUILDX_ENDPOINT: ${{ needs.base_build_setup.outputs.gh_buildx_endpoint }} - steps: - - name: Set Docker Tag - run: | - if [ "${{ github.event_name }}" == "release" ]; then - TAG=makeplane/plane-aio-app-full:stable - elif [ "${{ env.TARGET_BRANCH }}" == "master" ]; then - TAG=makeplane/plane-aio-app-full:latest - else - TAG=${{ env.AIO_IMAGE_TAGS }} - fi - echo "AIO_IMAGE_TAGS=${TAG}" >> $GITHUB_ENV - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - driver: ${{ env.BUILDX_DRIVER }} - version: ${{ env.BUILDX_VERSION }} - endpoint: ${{ env.BUILDX_ENDPOINT }} - - - name: Check out the repo - uses: actions/checkout@v4 - - - name: Build and Push Frontend to Docker Container Registry - uses: docker/build-push-action@v5.1.0 - with: - context: . - file: ./aio/Dockerfile-app - platforms: ${{ env.BUILDX_PLATFORMS }} - tags: ${{ env.AIO_IMAGE_TAGS }} - push: true - build-args: - BUILD_TAG=${{ env.AIO_BASE_TAG }} - BUILD_TYPE=full - - env: - DOCKER_BUILDKIT: 1 - DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} - diff --git a/.github/workflows/build-aio-branch.yml b/.github/workflows/build-aio-branch.yml new file mode 100644 index 00000000000..4ce48fd6712 --- /dev/null +++ b/.github/workflows/build-aio-branch.yml @@ -0,0 +1,164 @@ +name: Branch Build AIO + +on: + workflow_dispatch: + release: + types: [released, prereleased] + +env: + TARGET_BRANCH: ${{ github.ref_name || github.event.release.target_commitish }} + +jobs: + branch_build_setup: + name: Build Setup + runs-on: ubuntu-latest + outputs: + gh_branch_name: ${{ steps.set_env_variables.outputs.TARGET_BRANCH }} + gh_buildx_driver: ${{ steps.set_env_variables.outputs.BUILDX_DRIVER }} + gh_buildx_version: ${{ steps.set_env_variables.outputs.BUILDX_VERSION }} + gh_buildx_platforms: ${{ steps.set_env_variables.outputs.BUILDX_PLATFORMS }} + gh_buildx_endpoint: ${{ steps.set_env_variables.outputs.BUILDX_ENDPOINT }} + aio_base_tag: ${{ steps.set_env_variables.outputs.AIO_BASE_TAG }} + + steps: + - id: set_env_variables + name: Set Environment Variables + run: | + if [ "${{ env.TARGET_BRANCH }}" == "master" ] || [ "${{ github.event_name }}" == "release" ]; then + echo "BUILDX_DRIVER=cloud" >> $GITHUB_OUTPUT + echo "BUILDX_VERSION=lab:latest" >> $GITHUB_OUTPUT + echo "BUILDX_PLATFORMS=linux/amd64,linux/arm64" >> $GITHUB_OUTPUT + echo "BUILDX_ENDPOINT=makeplane/plane-dev" >> $GITHUB_OUTPUT + + echo "AIO_BASE_TAG=latest" >> $GITHUB_OUTPUT + else + echo "BUILDX_DRIVER=docker-container" >> $GITHUB_OUTPUT + echo "BUILDX_VERSION=latest" >> $GITHUB_OUTPUT + echo "BUILDX_PLATFORMS=linux/amd64" >> $GITHUB_OUTPUT + echo "BUILDX_ENDPOINT=" >> $GITHUB_OUTPUT + + if [ "${{ env.TARGET_BRANCH }}" == "preview" ]; then + echo "AIO_BASE_TAG=preview" >> $GITHUB_OUTPUT + else + echo "AIO_BASE_TAG=develop" >> $GITHUB_OUTPUT + fi + fi + echo "TARGET_BRANCH=${{ env.TARGET_BRANCH }}" >> $GITHUB_OUTPUT + + - id: checkout_files + name: Checkout Files + uses: actions/checkout@v4 + + full_build_push: + runs-on: ubuntu-20.04 + needs: [branch_build_setup] + env: + BUILD_TYPE: full + AIO_BASE_TAG: ${{ needs.branch_build_setup.outputs.aio_base_tag }} + AIO_IMAGE_TAGS: makeplane/plane-aio-app-full:${{ needs.branch_build_setup.outputs.gh_branch_name }} + TARGET_BRANCH: ${{ needs.branch_build_setup.outputs.gh_branch_name }} + BUILDX_DRIVER: ${{ needs.branch_build_setup.outputs.gh_buildx_driver }} + BUILDX_VERSION: ${{ needs.branch_build_setup.outputs.gh_buildx_version }} + BUILDX_PLATFORMS: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }} + BUILDX_ENDPOINT: ${{ needs.branch_build_setup.outputs.gh_buildx_endpoint }} + steps: + - name: Set Docker Tag + run: | + if [ "${{ github.event_name }}" == "release" ]; then + TAG=makeplane/plane-aio-app-${{env.BUILD_TYPE}}:stable,makeplane/plane-aio-app-${{env.BUILD_TYPE}}:${{ github.event.release.tag_name }} + elif [ "${{ env.TARGET_BRANCH }}" == "master" ]; then + TAG=makeplane/plane-aio-app-${{env.BUILD_TYPE}}:latest + else + TAG=${{ env.AIO_IMAGE_TAGS }} + fi + echo "AIO_IMAGE_TAGS=${TAG}" >> $GITHUB_ENV + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + driver: ${{ env.BUILDX_DRIVER }} + version: ${{ env.BUILDX_VERSION }} + endpoint: ${{ env.BUILDX_ENDPOINT }} + + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Build and Push Frontend to Docker Container Registry + uses: docker/build-push-action@v5.1.0 + with: + context: . + file: ./aio/Dockerfile-app + platforms: ${{ env.BUILDX_PLATFORMS }} + tags: ${{ env.AIO_IMAGE_TAGS }} + push: true + build-args: + BUILD_TAG=${{ env.AIO_BASE_TAG }} + BUILD_TYPE=${{env.BUILD_TYPE}} + + env: + DOCKER_BUILDKIT: 1 + DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} + + slim_build_push: + runs-on: ubuntu-20.04 + needs: [branch_build_setup] + env: + BUILD_TYPE: slim + AIO_BASE_TAG: ${{ needs.branch_build_setup.outputs.aio_base_tag }} + AIO_IMAGE_TAGS: makeplane/plane-aio-app-slim:${{ needs.branch_build_setup.outputs.gh_branch_name }} + TARGET_BRANCH: ${{ needs.branch_build_setup.outputs.gh_branch_name }} + BUILDX_DRIVER: ${{ needs.branch_build_setup.outputs.gh_buildx_driver }} + BUILDX_VERSION: ${{ needs.branch_build_setup.outputs.gh_buildx_version }} + BUILDX_PLATFORMS: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }} + BUILDX_ENDPOINT: ${{ needs.branch_build_setup.outputs.gh_buildx_endpoint }} + steps: + - name: Set Docker Tag + run: | + if [ "${{ github.event_name }}" == "release" ]; then + TAG=makeplane/plane-aio-app-${{env.BUILD_TYPE}}:stable,makeplane/plane-aio-app-${{env.BUILD_TYPE}}:${{ github.event.release.tag_name }} + elif [ "${{ env.TARGET_BRANCH }}" == "master" ]; then + TAG=makeplane/plane-aio-app-${{env.BUILD_TYPE}}:latest + else + TAG=${{ env.AIO_IMAGE_TAGS }} + fi + echo "AIO_IMAGE_TAGS=${TAG}" >> $GITHUB_ENV + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + driver: ${{ env.BUILDX_DRIVER }} + version: ${{ env.BUILDX_VERSION }} + endpoint: ${{ env.BUILDX_ENDPOINT }} + + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Build and Push Frontend to Docker Container Registry + uses: docker/build-push-action@v5.1.0 + with: + context: . + file: ./aio/Dockerfile-app + platforms: ${{ env.BUILDX_PLATFORMS }} + tags: ${{ env.AIO_IMAGE_TAGS }} + push: true + build-args: + BUILD_TAG=${{ env.AIO_BASE_TAG }} + BUILD_TYPE=${{env.BUILD_TYPE}} + + env: + DOCKER_BUILDKIT: 1 + DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}