Release Manually #63
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release Manually | |
on: | |
workflow_dispatch: | |
inputs: | |
job: | |
description: 'which docker build to run' | |
required: true | |
default: 'rocketmq-exporter' | |
type: choice | |
options: | |
- 'rocketmq-exporter' | |
- 'rocketmq-operator' | |
- 'rocketmq-nameserver' | |
- 'rocketmq-broker' | |
- 'rocketmq-dashboard' | |
- 'rocketmq-controller' | |
- 'community-server' | |
- 'community-router' | |
- 'community-operator' | |
- 'pgbouncer' | |
tag: | |
description: 'tag' | |
required: true | |
default: 'v0.0.1' | |
type: string | |
env: | |
ONLINE_REGISTER: ghcr.io/ksmartdata | |
BUILD_PLATFORM: linux/amd64,linux/arm64 | |
jobs: | |
rocketmq-exporter: | |
if: ${{ inputs.job == 'rocketmq-exporter' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git clone repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# - name: Clone RocketMQ Exporter | |
# uses: actions/checkout@v2 | |
# with: | |
# repository: apache/rocketmq-exporter | |
# ref: master | |
# - name: Set Up Java | |
# uses: actions/setup-java@v3 | |
# with: | |
# java-version: 8 | |
# distribution: 'temurin' | |
# - name: Customize Build Files | |
# run: | | |
# sed -i 's/FROM java:8/FROM --platform=$TARGETPLATFORM openjdk:8-jre-alpine/g' src/main/docker/Dockerfile | |
# | |
# - name: Build RocketMQ Exporter Image | |
# run: | | |
# mvn package -Dmaven.test.skip=true docker:build | |
# | |
# docker tag rocketmq-exporter:latest ${{ env.ONLINE_REGISTER }}/rocketmq-exporter:v1.0.0 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Build && Push | |
uses: docker/[email protected] | |
with: | |
context: ./arm64/images/ | |
file: ./arm64/images/rocketmq-exporter/Dockerfile | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
push: true | |
platforms: ${{ env.BUILD_PLATFORM }} | |
tags: | | |
${{ env.ONLINE_REGISTER }}/${{ inputs.job }}:${{ inputs.tag }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
rocketmq-operator: | |
if: ${{ inputs.job == 'rocketmq-operator' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# 使用官方的仓库,需要执行 make generate,但是下载 controller-gen 时不符合预期,所以临时使用 drivebyer/rocketmq-operator 仓库 | |
# 待 https://github.com/apache/rocketmq-operator/pull/169 合并和,可以切换回官方仓库 | |
- name: Clone RocketMQ Operator | |
uses: actions/checkout@v2 | |
with: | |
repository: drivebyer/rocketmq-operator | |
ref: mcamel | |
- name: Generate missing files | |
run: | | |
go mod tidy | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Build && Push | |
uses: docker/[email protected] | |
with: | |
context: . | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
push: true | |
build-args: | | |
TARGETOS=linux | |
platforms: ${{ env.BUILD_PLATFORM }} | |
tags: | | |
${{ env.ONLINE_REGISTER }}/${{ inputs.job }}:${{ inputs.tag }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
rocketmq-nameserver: | |
if: ${{ inputs.job == 'rocketmq-nameserver' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Clone RocketMQ Operator | |
uses: actions/checkout@v2 | |
with: | |
repository: apache/rocketmq-operator | |
ref: master | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Build && Push | |
uses: docker/[email protected] | |
with: | |
context: ./images/namesrv/alpine | |
file: ./images/namesrv/alpine/Dockerfile | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
push: true | |
platforms: ${{ env.BUILD_PLATFORM }} | |
build-args: | | |
version=${{ inputs.tag }} | |
tags: | | |
${{ env.ONLINE_REGISTER }}/${{ inputs.job }}:v${{ inputs.tag }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
rocketmq-controller: | |
if: ${{ inputs.job == 'rocketmq-controller' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Clone RocketMQ Operator | |
uses: actions/checkout@v2 | |
with: | |
repository: apache/rocketmq-operator | |
ref: master | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Build && Push | |
uses: docker/[email protected] | |
with: | |
context: ./images/controller/alpine | |
file: ./images/controller/alpine/Dockerfile | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
push: true | |
platforms: ${{ env.BUILD_PLATFORM }} | |
build-args: | | |
version=${{ inputs.tag }} | |
tags: | | |
${{ env.ONLINE_REGISTER }}/${{ inputs.job }}:v${{ inputs.tag }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
rocketmq-broker: | |
if: ${{ inputs.job == 'rocketmq-broker' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Clone RocketMQ Operator | |
uses: actions/checkout@v2 | |
with: | |
repository: apache/rocketmq-operator | |
ref: master | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Build && Push | |
uses: docker/[email protected] | |
with: | |
context: ./images/broker/alpine | |
file: ./images/broker/alpine/Dockerfile | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
push: true | |
platforms: ${{ env.BUILD_PLATFORM }} | |
build-args: | | |
version=${{ inputs.tag }} | |
tags: | | |
${{ env.ONLINE_REGISTER }}/${{ inputs.job }}:v${{ inputs.tag }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
rocketmq-dashboard: | |
if: ${{ inputs.job == 'rocketmq-dashboard' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Clone RocketMQ Docker | |
uses: actions/checkout@v2 | |
with: | |
repository: apache/rocketmq-docker | |
ref: master | |
- name: Customize RocketMQ Dashboard | |
run: | | |
# replace FROM centos:7 with FROM --platform=$TARGETPLATFORM centos:7 by sed | |
sed -i 's/FROM centos:7/FROM --platform=$TARGETPLATFORM centos:7/g' image-build/Dockerfile-centos-dashboard | |
# replace 3.6.3 to 3.9.4 | |
sed -i 's/3.6.3/3.9.4/g' image-build/Dockerfile-centos-dashboard | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Build && Push | |
uses: docker/[email protected] | |
with: | |
context: ./image-build | |
file: ./image-build/Dockerfile-centos-dashboard | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
push: true | |
platforms: ${{ env.BUILD_PLATFORM }} | |
build-args: | | |
version=${{ inputs.tag }} | |
tags: | | |
${{ env.ONLINE_REGISTER }}/${{ inputs.job }}:v${{ inputs.tag }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
community-server: | |
if: ${{ inputs.job == 'community-server' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Prepare images | |
run: | | |
docker pull container-registry.oracle.com/mysql/community-server:${{ inputs.tag }} | |
docker pull container-registry.oracle.com/mysql/community-server:${{ inputs.tag }}-aarch64 | |
docker tag container-registry.oracle.com/mysql/community-server:${{ inputs.tag }} ${{ env.ONLINE_REGISTER }}/community-server:${{ inputs.tag }}-amd64 | |
docker tag container-registry.oracle.com/mysql/community-server:${{ inputs.tag }}-aarch64 ${{ env.ONLINE_REGISTER }}/community-server:${{ inputs.tag }}-arm64 | |
docker push ${{ env.ONLINE_REGISTER }}/community-server:${{ inputs.tag }}-amd64 | |
docker push ${{ env.ONLINE_REGISTER }}/community-server:${{ inputs.tag }}-arm64 | |
- name: Create and push manifest images | |
uses: Noelware/docker-manifest-action@master | |
with: | |
inputs: ${{ env.ONLINE_REGISTER }}/${{ inputs.job }}:${{ inputs.tag }} | |
images: ${{ env.ONLINE_REGISTER }}/community-server:${{ inputs.tag }}-amd64,${{ env.ONLINE_REGISTER }}/community-server:${{ inputs.tag }}-arm64 | |
push: true | |
community-router: | |
if: ${{ inputs.job == 'community-router' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Prepare images | |
run: | | |
docker pull container-registry.oracle.com/mysql/community-router:${{ inputs.tag }} | |
docker pull container-registry.oracle.com/mysql/community-router:${{ inputs.tag }}-aarch64 | |
docker tag container-registry.oracle.com/mysql/community-router:${{ inputs.tag }} ${{ env.ONLINE_REGISTER }}/community-router:${{ inputs.tag }}-amd64 | |
docker tag container-registry.oracle.com/mysql/community-router:${{ inputs.tag }}-aarch64 ${{ env.ONLINE_REGISTER }}/community-router:${{ inputs.tag }}-arm64 | |
docker push ${{ env.ONLINE_REGISTER }}/community-router:${{ inputs.tag }}-amd64 | |
docker push ${{ env.ONLINE_REGISTER }}/community-router:${{ inputs.tag }}-arm64 | |
- name: Create and push manifest images | |
uses: Noelware/docker-manifest-action@master | |
with: | |
inputs: ${{ env.ONLINE_REGISTER }}/${{ inputs.job }}:${{ inputs.tag }} | |
images: ${{ env.ONLINE_REGISTER }}/community-router:${{ inputs.tag }}-amd64,${{ env.ONLINE_REGISTER }}/community-router:${{ inputs.tag }}-arm64 | |
push: true | |
community-operator: | |
if: ${{ inputs.job == 'community-operator' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Prepare images | |
run: | | |
docker pull container-registry.oracle.com/mysql/community-operator:${{ inputs.tag }} | |
docker pull container-registry.oracle.com/mysql/community-operator:${{ inputs.tag }}-aarch64 | |
docker tag container-registry.oracle.com/mysql/community-operator:${{ inputs.tag }} ${{ env.ONLINE_REGISTER }}/community-operator:${{ inputs.tag }}-amd64 | |
docker tag container-registry.oracle.com/mysql/community-operator:${{ inputs.tag }}-aarch64 ${{ env.ONLINE_REGISTER }}/community-operator:${{ inputs.tag }}-arm64 | |
docker push ${{ env.ONLINE_REGISTER }}/community-operator:${{ inputs.tag }}-amd64 | |
docker push ${{ env.ONLINE_REGISTER }}/community-operator:${{ inputs.tag }}-arm64 | |
- name: Create and push manifest images | |
uses: Noelware/docker-manifest-action@master | |
with: | |
inputs: ${{ env.ONLINE_REGISTER }}/${{ inputs.job }}:${{ inputs.tag }} | |
images: ${{ env.ONLINE_REGISTER }}/community-operator:${{ inputs.tag }}-amd64,${{ env.ONLINE_REGISTER }}/community-operator:${{ inputs.tag }}-arm64 | |
push: true | |
- name: Prepare images sidecar(used for initconf, sidecar, batchjob/backup) | |
run: | | |
docker pull container-registry.oracle.com/mysql/community-operator:${{ inputs.tag }}-2.0.11 | |
docker pull container-registry.oracle.com/mysql/community-operator:${{ inputs.tag }}-2.0.11-aarch64 | |
docker tag container-registry.oracle.com/mysql/community-operator:${{ inputs.tag }}-2.0.11 ${{ env.ONLINE_REGISTER }}/community-operator:${{ inputs.tag }}-2.0.11-amd64 | |
docker tag container-registry.oracle.com/mysql/community-operator:${{ inputs.tag }}-2.0.11-aarch64 ${{ env.ONLINE_REGISTER }}/community-operator:${{ inputs.tag }}-2.0.11-arm64 | |
docker push ${{ env.ONLINE_REGISTER }}/community-operator:${{ inputs.tag }}-2.0.11-amd64 | |
docker push ${{ env.ONLINE_REGISTER }}/community-operator:${{ inputs.tag }}-2.0.11-arm64 | |
- name: Create and push manifest images sidecar(used for initconf, sidecar, batchjob/backup) | |
uses: Noelware/docker-manifest-action@master | |
with: | |
inputs: ${{ env.ONLINE_REGISTER }}/${{ inputs.job }}:${{ inputs.tag }}-2.0.11 | |
images: ${{ env.ONLINE_REGISTER }}/community-operator:${{ inputs.tag }}-2.0.11-amd64,${{ env.ONLINE_REGISTER }}/community-operator:${{ inputs.tag }}-2.0.11-arm64 | |
push: true | |
pgbouncer: | |
if: ${{ inputs.job == 'pgbouncer' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git clone repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Build && Push | |
uses: docker/[email protected] | |
with: | |
context: ./arm64/images/ | |
file: ./arm64/images/pgbouncer/Dockerfile | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
push: true | |
#platforms: ${{ env.BUILD_PLATFORM }} 目前只有 amd,先注释掉 | |
tags: | | |
${{ env.ONLINE_REGISTER }}/${{ inputs.job }}:${{ inputs.tag }} | |
build-args: | | |
PGBOUNCER_VERSION=${{ inputs.tag }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
# - name: Prepare images | |
# run: | | |
# docker pull registry.opensource.zalan.do/acid/pgbouncer:${{ inputs.tag }} | |
# docker tag registry.opensource.zalan.do/acid/pgbouncer:${{ inputs.tag }} ${{ env.ONLINE_REGISTER }}/pgbouncer:${{ inputs.tag }} | |
# docker push ${{ env.ONLINE_REGISTER }}/pgbouncer:${{ inputs.tag }} |