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/main.yml b/.github/workflows/docker-image-build-latest.yml similarity index 80% rename from .github/workflows/main.yml rename to .github/workflows/docker-image-build-latest.yml index 3452c46..a6557b2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/docker-image-build-latest.yml @@ -1,12 +1,10 @@ -name: CI +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 ] - pull_request: - branches: [ master ] schedule: - cron: "0 0 * * 6" @@ -17,46 +15,40 @@ on: # 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 + build: + name: Build and publish runs-on: ubuntu-latest strategy: - fail-fast: false matrix: gearman_version: [ '1.1.20' ] + gearman_version_minor: [ '1.1' ] steps: - - - name: Prepare env variables + - 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 + - name: Check out code uses: actions/checkout@v3 - - - name: Set up Docker Buildx + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - - name: Login to DockerHub + - name: Login to DockerHub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Login to GitHub Container Registry + - 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 + - name: Build images and push to registry uses: docker/build-push-action@v3 with: platforms: linux/amd64 @@ -70,8 +62,10 @@ jobs: GEARMAN_VERSION=${{ matrix.gearman_version }} tags: | 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 @@ -82,12 +76,10 @@ jobs: runs-on: ubuntu-latest steps: - - - name: Check out code + - name: Check out code uses: actions/checkout@v3 - - - name: Update Docker Hub repo description + - name: Update Docker Hub repo description uses: peter-evans/dockerhub-description@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} 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 ⭐