From 3526eb6970b85b53a2ff2a2b6d39e829e5fbb7f4 Mon Sep 17 00:00:00 2001 From: Manish Gupta Date: Fri, 20 Dec 2024 15:04:03 +0530 Subject: [PATCH 1/2] updated action to use makeplane/actions repo --- .github/actions/build-push-ce/action.yml | 126 ----------------------- .github/workflows/build-branch.yml | 57 +++++----- 2 files changed, 27 insertions(+), 156 deletions(-) delete mode 100644 .github/actions/build-push-ce/action.yml diff --git a/.github/actions/build-push-ce/action.yml b/.github/actions/build-push-ce/action.yml deleted file mode 100644 index acf06982d31..00000000000 --- a/.github/actions/build-push-ce/action.yml +++ /dev/null @@ -1,126 +0,0 @@ -name: "Build and Push Docker Image" -description: "Reusable action for building and pushing Docker images" -inputs: - docker-username: - description: "The Dockerhub username" - required: true - docker-token: - description: "The Dockerhub Token" - required: true - - # Docker Image Options - docker-image-owner: - description: "The owner of the Docker image" - required: true - docker-image-name: - description: "The name of the Docker image" - required: true - build-context: - description: "The build context" - required: true - default: "." - dockerfile-path: - description: "The path to the Dockerfile" - required: true - build-args: - description: "The build arguments" - required: false - default: "" - - # Buildx Options - buildx-driver: - description: "Buildx driver" - required: true - default: "docker-container" - buildx-version: - description: "Buildx version" - required: true - default: "latest" - buildx-platforms: - description: "Buildx platforms" - required: true - default: "linux/amd64" - buildx-endpoint: - description: "Buildx endpoint" - required: true - default: "default" - - # Release Build Options - build-release: - description: "Flag to publish release" - required: false - default: "false" - build-prerelease: - description: "Flag to publish prerelease" - required: false - default: "false" - release-version: - description: "The release version" - required: false - default: "latest" - -runs: - using: "composite" - steps: - - name: Set Docker Tag - shell: bash - env: - IMG_OWNER: ${{ inputs.docker-image-owner }} - IMG_NAME: ${{ inputs.docker-image-name }} - BUILD_RELEASE: ${{ inputs.build-release }} - IS_PRERELEASE: ${{ inputs.build-prerelease }} - REL_VERSION: ${{ inputs.release-version }} - run: | - FLAT_BRANCH_VERSION=$(echo "${{ github.ref_name }}" | sed 's/[^a-zA-Z0-9.-]//g') - - if [ "${{ env.BUILD_RELEASE }}" == "true" ]; then - semver_regex="^v([0-9]+)\.([0-9]+)\.([0-9]+)(-[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*)?$" - if [[ ! ${{ env.REL_VERSION }} =~ $semver_regex ]]; then - echo "Invalid Release Version Format : ${{ env.REL_VERSION }}" - echo "Please provide a valid SemVer version" - echo "e.g. v1.2.3 or v1.2.3-alpha-1" - echo "Exiting the build process" - exit 1 # Exit with status 1 to fail the step - fi - - TAG=${{ env.IMG_OWNER }}/${{ env.IMG_NAME }}:${{ env.REL_VERSION }} - - if [ "${{ env.IS_PRERELEASE }}" != "true" ]; then - TAG=${TAG},${{ env.IMG_OWNER }}/${{ env.IMG_NAME }}:stable - fi - elif [ "${{ env.TARGET_BRANCH }}" == "master" ]; then - TAG=${{ env.IMG_OWNER }}/${{ env.IMG_NAME }}:latest - else - TAG=${{ env.IMG_OWNER }}/${{ env.IMG_NAME }}:${FLAT_BRANCH_VERSION} - fi - - echo "DOCKER_TAGS=${TAG}" >> $GITHUB_ENV - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ inputs.docker-username }} - password: ${{ inputs.docker-token}} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - driver: ${{ inputs.buildx-driver }} - version: ${{ inputs.buildx-version }} - endpoint: ${{ inputs.buildx-endpoint }} - - - name: Check out the repo - uses: actions/checkout@v4 - - - name: Build and Push Docker Image - uses: docker/build-push-action@v5.1.0 - with: - context: ${{ inputs.build-context }} - file: ${{ inputs.dockerfile-path }} - platforms: ${{ inputs.buildx-platforms }} - tags: ${{ env.DOCKER_TAGS }} - push: true - build-args: ${{ inputs.build-args }} - env: - DOCKER_BUILDKIT: 1 - DOCKER_USERNAME: ${{ inputs.docker-username }} - DOCKER_PASSWORD: ${{ inputs.docker-token }} \ No newline at end of file diff --git a/.github/workflows/build-branch.yml b/.github/workflows/build-branch.yml index 627c782f998..4dbc43a9a82 100644 --- a/.github/workflows/build-branch.yml +++ b/.github/workflows/build-branch.yml @@ -36,7 +36,7 @@ env: jobs: branch_build_setup: name: Build Setup - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 outputs: gh_branch_name: ${{ steps.set_env_variables.outputs.TARGET_BRANCH }} gh_buildx_driver: ${{ steps.set_env_variables.outputs.BUILDX_DRIVER }} @@ -160,20 +160,17 @@ jobs: branch_build_push_admin: if: ${{ needs.branch_build_setup.outputs.build_admin == 'true' || github.event_name == 'workflow_dispatch' || needs.branch_build_setup.outputs.gh_branch_name == 'master' }} name: Build-Push Admin Docker Image - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 needs: [branch_build_setup] steps: - - id: checkout_files - name: Checkout Files - uses: actions/checkout@v4 - name: Admin Build and Push - uses: ./.github/actions/build-push-ce + uses: makeplane/actions/build-push@v1.0.0 with: build-release: ${{ needs.branch_build_setup.outputs.build_release }} build-prerelease: ${{ needs.branch_build_setup.outputs.build_prerelease }} release-version: ${{ needs.branch_build_setup.outputs.release_version }} - docker-username: ${{ secrets.DOCKERHUB_USERNAME }} - docker-token: ${{ secrets.DOCKERHUB_TOKEN }} + dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} docker-image-owner: makeplane docker-image-name: ${{ needs.branch_build_setup.outputs.dh_img_admin }} build-context: . @@ -186,20 +183,20 @@ jobs: branch_build_push_web: if: ${{ needs.branch_build_setup.outputs.build_web == 'true' || github.event_name == 'workflow_dispatch' || needs.branch_build_setup.outputs.gh_branch_name == 'master' }} name: Build-Push Web Docker Image - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 needs: [branch_build_setup] steps: - id: checkout_files name: Checkout Files uses: actions/checkout@v4 - name: Web Build and Push - uses: ./.github/actions/build-push-ce + uses: makeplane/actions/build-push@v1.0.0 with: build-release: ${{ needs.branch_build_setup.outputs.build_release }} build-prerelease: ${{ needs.branch_build_setup.outputs.build_prerelease }} release-version: ${{ needs.branch_build_setup.outputs.release_version }} - docker-username: ${{ secrets.DOCKERHUB_USERNAME }} - docker-token: ${{ secrets.DOCKERHUB_TOKEN }} + dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} docker-image-owner: makeplane docker-image-name: ${{ needs.branch_build_setup.outputs.dh_img_web }} build-context: . @@ -212,20 +209,20 @@ jobs: branch_build_push_space: if: ${{ needs.branch_build_setup.outputs.build_space == 'true' || github.event_name == 'workflow_dispatch' || needs.branch_build_setup.outputs.gh_branch_name == 'master' }} name: Build-Push Space Docker Image - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 needs: [branch_build_setup] steps: - id: checkout_files name: Checkout Files uses: actions/checkout@v4 - name: Space Build and Push - uses: ./.github/actions/build-push-ce + uses: makeplane/actions/build-push@v1.0.0 with: build-release: ${{ needs.branch_build_setup.outputs.build_release }} build-prerelease: ${{ needs.branch_build_setup.outputs.build_prerelease }} release-version: ${{ needs.branch_build_setup.outputs.release_version }} - docker-username: ${{ secrets.DOCKERHUB_USERNAME }} - docker-token: ${{ secrets.DOCKERHUB_TOKEN }} + dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} docker-image-owner: makeplane docker-image-name: ${{ needs.branch_build_setup.outputs.dh_img_space }} build-context: . @@ -238,20 +235,20 @@ jobs: branch_build_push_live: if: ${{ needs.branch_build_setup.outputs.build_live == 'true' || github.event_name == 'workflow_dispatch' || needs.branch_build_setup.outputs.gh_branch_name == 'master' }} name: Build-Push Live Collaboration Docker Image - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 needs: [branch_build_setup] steps: - id: checkout_files name: Checkout Files uses: actions/checkout@v4 - name: Live Build and Push - uses: ./.github/actions/build-push-ce + uses: makeplane/actions/build-push@v1.0.0 with: build-release: ${{ needs.branch_build_setup.outputs.build_release }} build-prerelease: ${{ needs.branch_build_setup.outputs.build_prerelease }} release-version: ${{ needs.branch_build_setup.outputs.release_version }} - docker-username: ${{ secrets.DOCKERHUB_USERNAME }} - docker-token: ${{ secrets.DOCKERHUB_TOKEN }} + dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} docker-image-owner: makeplane docker-image-name: ${{ needs.branch_build_setup.outputs.dh_img_live }} build-context: . @@ -264,20 +261,20 @@ jobs: branch_build_push_apiserver: if: ${{ needs.branch_build_setup.outputs.build_apiserver == 'true' || github.event_name == 'workflow_dispatch' || needs.branch_build_setup.outputs.gh_branch_name == 'master' }} name: Build-Push API Server Docker Image - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 needs: [branch_build_setup] steps: - id: checkout_files name: Checkout Files uses: actions/checkout@v4 - name: Backend Build and Push - uses: ./.github/actions/build-push-ce + uses: makeplane/actions/build-push@v1.0.0 with: build-release: ${{ needs.branch_build_setup.outputs.build_release }} build-prerelease: ${{ needs.branch_build_setup.outputs.build_prerelease }} release-version: ${{ needs.branch_build_setup.outputs.release_version }} - docker-username: ${{ secrets.DOCKERHUB_USERNAME }} - docker-token: ${{ secrets.DOCKERHUB_TOKEN }} + dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} docker-image-owner: makeplane docker-image-name: ${{ needs.branch_build_setup.outputs.dh_img_backend }} build-context: ./apiserver @@ -290,20 +287,20 @@ jobs: branch_build_push_proxy: if: ${{ needs.branch_build_setup.outputs.build_proxy == 'true' || github.event_name == 'workflow_dispatch' || needs.branch_build_setup.outputs.gh_branch_name == 'master' }} name: Build-Push Proxy Docker Image - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 needs: [branch_build_setup] steps: - id: checkout_files name: Checkout Files uses: actions/checkout@v4 - name: Proxy Build and Push - uses: ./.github/actions/build-push-ce + uses: makeplane/actions/build-push@v1.0.0 with: build-release: ${{ needs.branch_build_setup.outputs.build_release }} build-prerelease: ${{ needs.branch_build_setup.outputs.build_prerelease }} release-version: ${{ needs.branch_build_setup.outputs.release_version }} - docker-username: ${{ secrets.DOCKERHUB_USERNAME }} - docker-token: ${{ secrets.DOCKERHUB_TOKEN }} + dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} docker-image-owner: makeplane docker-image-name: ${{ needs.branch_build_setup.outputs.dh_img_proxy }} build-context: ./nginx @@ -316,7 +313,7 @@ jobs: attach_assets_to_build: if: ${{ needs.branch_build_setup.outputs.build_type == 'Release' }} name: Attach Assets to Release - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 needs: [branch_build_setup] steps: - name: Checkout @@ -341,7 +338,7 @@ jobs: publish_release: if: ${{ needs.branch_build_setup.outputs.build_type == 'Release' }} name: Build Release - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 needs: [ branch_build_setup, From d44e175b107c8dc92e3175aa81c52d9a225fc614 Mon Sep 17 00:00:00 2001 From: Manish Gupta Date: Fri, 20 Dec 2024 15:10:34 +0530 Subject: [PATCH 2/2] updated action --- .github/workflows/build-branch.yml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/.github/workflows/build-branch.yml b/.github/workflows/build-branch.yml index 4dbc43a9a82..7d32b73c4e1 100644 --- a/.github/workflows/build-branch.yml +++ b/.github/workflows/build-branch.yml @@ -186,9 +186,6 @@ jobs: runs-on: ubuntu-22.04 needs: [branch_build_setup] steps: - - id: checkout_files - name: Checkout Files - uses: actions/checkout@v4 - name: Web Build and Push uses: makeplane/actions/build-push@v1.0.0 with: @@ -212,9 +209,6 @@ jobs: runs-on: ubuntu-22.04 needs: [branch_build_setup] steps: - - id: checkout_files - name: Checkout Files - uses: actions/checkout@v4 - name: Space Build and Push uses: makeplane/actions/build-push@v1.0.0 with: @@ -238,9 +232,6 @@ jobs: runs-on: ubuntu-22.04 needs: [branch_build_setup] steps: - - id: checkout_files - name: Checkout Files - uses: actions/checkout@v4 - name: Live Build and Push uses: makeplane/actions/build-push@v1.0.0 with: @@ -264,9 +255,6 @@ jobs: runs-on: ubuntu-22.04 needs: [branch_build_setup] steps: - - id: checkout_files - name: Checkout Files - uses: actions/checkout@v4 - name: Backend Build and Push uses: makeplane/actions/build-push@v1.0.0 with: @@ -290,9 +278,6 @@ jobs: runs-on: ubuntu-22.04 needs: [branch_build_setup] steps: - - id: checkout_files - name: Checkout Files - uses: actions/checkout@v4 - name: Proxy Build and Push uses: makeplane/actions/build-push@v1.0.0 with: