This is an automated email from the ASF dual-hosted git repository.
jinrongtong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-docker.git
The following commit(s) were added to refs/heads/master by this push:
new 29a9cd5 [ISSUE #116] add workflow for multi-ach Docker image
29a9cd5 is described below
commit 29a9cd596292598019f83c89d382b671e13c7d77
Author: caigy <[email protected]>
AuthorDate: Thu Feb 13 10:04:23 2025 +0800
[ISSUE #116] add workflow for multi-ach Docker image
change name of secrets
---
.github/workflows/docker-publish.yml | 58 ++++++++++++++++++++++++++++++++++--
1 file changed, 56 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/docker-publish.yml
b/.github/workflows/docker-publish.yml
index 0df8bf7..abfa0ad 100644
--- a/.github/workflows/docker-publish.yml
+++ b/.github/workflows/docker-publish.yml
@@ -1,7 +1,12 @@
name: docker-publish
on:
- workflow_dispatch:
+ schedule:
+ - cron: '0 * * * *'
+ push:
+ branches: [ "master" ]
+ pull_request:
+ branches: [ "master" ]
env:
REGISTRY: docker.io
@@ -18,10 +23,59 @@ jobs:
packages: write
steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ - name: Get the latest release version with GitHub Script
+ id: get_release
+ uses: actions/github-script@v6
+ with:
+ script: |
+ const { data: latestRelease } = await
github.rest.repos.getLatestRelease({
+ owner: 'apache',
+ repo: 'rocketmq'
+ });
+ core.setOutput('version_on_github',
latestRelease.tag_name.replaceAll("rocketmq-all-", ""));
+
+ - name: Output the latest release version
+ run: echo "The latest release version is ${{
steps.get_release.outputs.version_on_github }}"
+
+ - name: Check if Docker image exists
+ id: check_image
+ run: |
+ TAG="${{ steps.get_release.outputs.version_on_github }}"
+ EXISTS=$(curl -s -o /dev/null -w "%{http_code}"
"https://hub.docker.com/v2/repositories/${{ env.IMAGE_NAME }}/tags/$TAG/")
+ if [ "$EXISTS" -eq "200" ]; then
+ echo "exists=true" >> $GITHUB_ENV
+ else
+ echo "exists=false" >> $GITHUB_ENV
+ fi
+
+ - name: Set up Docker Buildx
+ if: env.exists == 'false'
+ uses:
docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
+
- name: Log into registry ${{ env.REGISTRY }}
- #if: env.exists == 'false' && github.event_name != 'pull_request'
+ if: env.exists == 'false' && github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
+
+ - name: Build and push Docker image
+ id: build-and-push
+ if: env.exists == 'false'
+ uses: docker/build-push-action@v6
+ with:
+ context: "{{defaultContext}}:image-build"
+ file: Dockerfile-ubuntu
+ platforms: linux/amd64,linux/arm64
+ pull: true
+ push: ${{ github.event_name != 'pull_request' }}
+ tags: |
+ ${{ env.IMAGE_NAME }}:latest
+ ${{ env.IMAGE_NAME }}:${{
steps.get_release.outputs.version_on_github }}
+ build-args: version=${{ steps.get_release.outputs.version_on_github
}}
+ cache-from: type=gha
+ cache-to: type=gha,mode=max