From 9b645d6ada6e9cbe819e37187405502557544bdb Mon Sep 17 00:00:00 2001 From: Alexander Tebiev Date: Sat, 14 Jan 2023 16:16:19 +0100 Subject: [PATCH 1/2] Some improvements --- .../workflows/docker-image-build-develop.yml | 56 +++++++++++++ .../workflows/docker-image-build-latest.yml | 80 +++++++++++++++++++ .github/workflows/main.yml | 1 - README.md | 2 +- 4 files changed, 137 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/docker-image-build-develop.yml create mode 100644 .github/workflows/docker-image-build-latest.yml diff --git a/.github/workflows/docker-image-build-develop.yml b/.github/workflows/docker-image-build-develop.yml new file mode 100644 index 0000000..600282b --- /dev/null +++ b/.github/workflows/docker-image-build-develop.yml @@ -0,0 +1,56 @@ +name: Build [develop] docker image + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ develop ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + + build: + name: Build and publish + runs-on: ubuntu-latest + strategy: + matrix: + gearman_version: [ '1.1.20' ] + + steps: + - name: Prepare env variables + run: | + echo "BUILD_DATE=$(TZ=':UTC' date +'%Y-%m-%d %H:%M:%S (%Z)')" >> ${GITHUB_ENV} + echo "BUILD_FINGERPRINT=${GITHUB_SHA::7}" >> ${GITHUB_ENV} + + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GH_TOKEN }} + + - name: Build images and push to registry + uses: docker/build-push-action@v3 + with: + platforms: linux/amd64 + cache-from: type=gha, scope=${{ github.workflow }}-${{ matrix.gearman_version }} + cache-to: type=gha, scope=${{ github.workflow }}-${{ matrix.gearman_version }}, mode=max + context: . + file: ./docker/Dockerfile + build-args: | + BUILD_DATE=${{ env.BUILD_DATE }} + BUILD_FINGERPRINT=${{ env.BUILD_FINGERPRINT }} + GEARMAN_VERSION=${{ matrix.gearman_version }} + tags: | + ghcr.io/phplegacy/gearman-docker:develop + pull: true + push: true diff --git a/.github/workflows/docker-image-build-latest.yml b/.github/workflows/docker-image-build-latest.yml new file mode 100644 index 0000000..00876da --- /dev/null +++ b/.github/workflows/docker-image-build-latest.yml @@ -0,0 +1,80 @@ +name: Build [latest] docker image + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ master ] + + schedule: + - cron: "0 0 * * 6" + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + + build: + name: Build, test and publish + runs-on: ubuntu-latest + + steps: + - name: Prepare env variables + run: | + echo "BUILD_DATE=$(TZ=':UTC' date +'%Y-%m-%d %H:%M:%S (%Z)')" >> ${GITHUB_ENV} + echo "BUILD_FINGERPRINT=${GITHUB_SHA::7}" >> ${GITHUB_ENV} + + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GH_TOKEN }} + + - name: Build images and push to registry + uses: docker/build-push-action@v3 + with: + platforms: linux/amd64 + cache-from: type=gha, scope=${{ github.workflow }} + cache-to: type=gha, scope=${{ github.workflow }}, mode=max + context: . + file: ./docker/Dockerfile + target: php-prod + build-args: | + BUILD_DATE=${{ env.BUILD_DATE }} + BUILD_FINGERPRINT=${{ env.BUILD_FINGERPRINT }} + tags: | + legacyphp/memcachedadmin:latest + ghcr.io/phplegacy/memcachedadmin-docker:latest + pull: true + push: true + + + Update-Docker-Hub-repo-description: + name: Update Docker Hub repo description + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Update Docker Hub repo description + uses: peter-evans/dockerhub-description@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + repository: legacyphp/memcachedadmin + #short-description: ${{ github.event.repository.description }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3452c46..2297c1e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,7 +21,6 @@ jobs: name: Build, test and publish runs-on: ubuntu-latest strategy: - fail-fast: false matrix: gearman_version: [ '1.1.20' ] diff --git a/README.md b/README.md index c47d225..bc10022 100644 --- a/README.md +++ b/README.md @@ -68,4 +68,4 @@ You can also inject your version of config file to `/etc/gearmand.conf` as neede The MIT License (MIT). Please see [License File](https://github.com/phplegacy/gearman-docker/blob/master/LICENSE) for more information. --- -If you like this project, please consider giving me a ⭐ +If you like this project, please consider giving it a ⭐ From 706bb436e0967bc600edacae4bf24dcabf9cb83c Mon Sep 17 00:00:00 2001 From: Alexander Tebiev Date: Sat, 14 Jan 2023 16:21:28 +0100 Subject: [PATCH 2/2] Some improvements --- .../workflows/docker-image-build-latest.yml | 22 +++-- .github/workflows/main.yml | 95 ------------------- 2 files changed, 15 insertions(+), 102 deletions(-) delete mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/docker-image-build-latest.yml b/.github/workflows/docker-image-build-latest.yml index 00876da..a6557b2 100644 --- a/.github/workflows/docker-image-build-latest.yml +++ b/.github/workflows/docker-image-build-latest.yml @@ -16,8 +16,12 @@ on: jobs: build: - name: Build, test and publish + name: Build and publish runs-on: ubuntu-latest + strategy: + matrix: + gearman_version: [ '1.1.20' ] + gearman_version_minor: [ '1.1' ] steps: - name: Prepare env variables @@ -48,17 +52,21 @@ jobs: uses: docker/build-push-action@v3 with: platforms: linux/amd64 - cache-from: type=gha, scope=${{ github.workflow }} - cache-to: type=gha, scope=${{ github.workflow }}, mode=max + cache-from: type=gha, scope=${{ github.workflow }}-${{ matrix.gearman_version }} + cache-to: type=gha, scope=${{ github.workflow }}-${{ matrix.gearman_version }}, mode=max context: . file: ./docker/Dockerfile - target: php-prod build-args: | BUILD_DATE=${{ env.BUILD_DATE }} BUILD_FINGERPRINT=${{ env.BUILD_FINGERPRINT }} + GEARMAN_VERSION=${{ matrix.gearman_version }} tags: | - legacyphp/memcachedadmin:latest - ghcr.io/phplegacy/memcachedadmin-docker:latest + legacyphp/gearman:${{ matrix.gearman_version }} + legacyphp/gearman:${{ matrix.gearman_version_minor }} + legacyphp/gearman:latest + ghcr.io/phplegacy/gearman-docker:${{ matrix.gearman_version }} + ghcr.io/phplegacy/gearman-docker:${{ matrix.gearman_version_minor }} + ghcr.io/phplegacy/gearman-docker:latest pull: true push: true @@ -76,5 +84,5 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - repository: legacyphp/memcachedadmin + repository: legacyphp/gearman #short-description: ${{ github.event.repository.description }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 2297c1e..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,95 +0,0 @@ -name: CI - -# Controls when the workflow will run -on: - # Triggers the workflow on push or pull request events but only for the master branch - push: - branches: [ master ] - pull_request: - branches: [ master ] - - schedule: - - cron: "0 0 * * 6" - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - - build-gearman: - name: Build, test and publish - runs-on: ubuntu-latest - strategy: - matrix: - gearman_version: [ '1.1.20' ] - - steps: - - - name: Prepare env variables - run: | - echo "BUILD_DATE=$(TZ=':UTC' date +'%Y-%m-%d %H:%M:%S (%Z)')" >> ${GITHUB_ENV} - echo "BUILD_FINGERPRINT=${GITHUB_SHA::7}" >> ${GITHUB_ENV} - - - - name: Check out code - uses: actions/checkout@v3 - - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GH_TOKEN }} - - - - name: Build images and push to registry - uses: docker/build-push-action@v3 - with: - platforms: linux/amd64 - cache-from: type=gha, scope=${{ github.workflow }}-${{ matrix.gearman_version }} - cache-to: type=gha, scope=${{ github.workflow }}-${{ matrix.gearman_version }}, mode=max - context: . - file: ./docker/Dockerfile - build-args: | - BUILD_DATE=${{ env.BUILD_DATE }} - BUILD_FINGERPRINT=${{ env.BUILD_FINGERPRINT }} - GEARMAN_VERSION=${{ matrix.gearman_version }} - tags: | - legacyphp/gearman:${{ matrix.gearman_version }} - legacyphp/gearman:latest - ghcr.io/phplegacy/gearman-docker:${{ matrix.gearman_version }} - ghcr.io/phplegacy/gearman-docker:latest - pull: true - push: true - - - Update-Docker-Hub-repo-description: - name: Update Docker Hub repo description - runs-on: ubuntu-latest - - steps: - - - name: Check out code - uses: actions/checkout@v3 - - - - name: Update Docker Hub repo description - uses: peter-evans/dockerhub-description@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} - repository: legacyphp/gearman - #short-description: ${{ github.event.repository.description }}