From 3ffdfef2082c423871c80baf5d88f8bfcd496fb0 Mon Sep 17 00:00:00 2001 From: EdyTheCow Date: Thu, 2 Oct 2025 17:10:11 +0200 Subject: [PATCH] Trying my luck with workflows again... --- .github/workflows/build-image-common.yml | 42 ++++++++++++++++++++ .github/workflows/build-whmcs-nginx.yml | 19 +++++++++ .github/workflows/build-whmcs-php-fpm.yml | 19 +++++++++ .github/workflows/docker-publish.yml | 47 ----------------------- 4 files changed, 80 insertions(+), 47 deletions(-) create mode 100644 .github/workflows/build-image-common.yml create mode 100644 .github/workflows/build-whmcs-nginx.yml create mode 100644 .github/workflows/build-whmcs-php-fpm.yml delete mode 100644 .github/workflows/docker-publish.yml diff --git a/.github/workflows/build-image-common.yml b/.github/workflows/build-image-common.yml new file mode 100644 index 0000000..16eda28 --- /dev/null +++ b/.github/workflows/build-image-common.yml @@ -0,0 +1,42 @@ +name: Build & Push Docker Image Common + +on: + workflow_call: + inputs: + context: + required: true + type: string + image_tag: + required: true + type: string + secrets: + GITHUB_TOKEN: + required: true + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build & push image + uses: docker/build-push-action@v6 + with: + context: ${{ inputs.context }} + push: true + tags: ${{ inputs.image_tag }} \ No newline at end of file diff --git a/.github/workflows/build-whmcs-nginx.yml b/.github/workflows/build-whmcs-nginx.yml new file mode 100644 index 0000000..41ff267 --- /dev/null +++ b/.github/workflows/build-whmcs-nginx.yml @@ -0,0 +1,19 @@ +name: Build WHMCS NGINX + +on: + push: + branches: [ docker-images ] + paths: + - 'whmcs-nginx/**' + pull_request: + paths: + - 'whmcs-nginx/**' + +jobs: + build: + uses: ./.github/workflows/build-image-common.yml + with: + context: whmcs-nginx + image_tag: ghcr.io/edythecow/whmcs-nginx:latest + secrets: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/build-whmcs-php-fpm.yml b/.github/workflows/build-whmcs-php-fpm.yml new file mode 100644 index 0000000..8690dd9 --- /dev/null +++ b/.github/workflows/build-whmcs-php-fpm.yml @@ -0,0 +1,19 @@ +name: Build WHMCS PHP-FPM + +on: + push: + branches: [ docker-images ] + paths: + - 'whmcs-php-fpm/**' + pull_request: + paths: + - 'whmcs-php-fpm/**' + +jobs: + build: + uses: ./.github/workflows/build-image-common.yml + with: + context: whmcs-php-fpm + image_tag: ghcr.io/edythecow/whmcs-php-fpm:latest + secrets: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml deleted file mode 100644 index 8fbfab1..0000000 --- a/.github/workflows/docker-publish.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Build and publish WHMCS Docker images - -on: - push: - branches: [ docker-images ] - paths: - - 'whmcs-php-fpm/**' - - 'whmcs-nginx/**' - pull_request: - paths: - - 'whmcs-php-fpm/**' - - 'whmcs-nginx/**' - -jobs: - build-and-push: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write # required to push to ghcr.io - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to GHCR - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build & push whmcs-php-fpm - uses: docker/build-push-action@v6 - with: - context: whmcs-php-fpm/ - push: true - tags: ghcr.io/edythecow/whmcs-php-fpm:latest - - - name: Build & push whmcs-nginx - uses: docker/build-push-action@v6 - with: - context: whmcs-nginx/ - push: true - tags: ghcr.io/edythecow/whmcs-nginx:latest