PIG 镜像 action #16
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: PIG 镜像 action | |
on: | |
workflow_dispatch: | |
inputs: | |
IMAGE_NAME: | |
description: 'dockerhub镜像名称' | |
required: true | |
default: 'mysql/mysql-server' | |
NEW_NAME: | |
description: '变更到阿里云后镜像名称' | |
required: true | |
default: 'mysql-server' | |
IMAGE_VERSION: | |
description: '镜像版本' | |
required: true | |
default: 'latest' | |
TARGET_REGISTRY: | |
description: '仓库地址' | |
required: true | |
default: 'registry.cn-hangzhou.aliyuncs.com' | |
TARGET_REPOSITORY: | |
description: '空间名称' | |
required: true | |
default: 'dockerhub_mirror' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to Docker Registry | |
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} ${{ github.event.inputs.TARGET_REGISTRY }} | |
- name: Pull, tag, and push Docker image | |
run: | | |
docker pull ${{ github.event.inputs.IMAGE_NAME }}:${{ github.event.inputs.IMAGE_VERSION }} | |
docker tag ${{ github.event.inputs.IMAGE_NAME }}:${{ github.event.inputs.IMAGE_VERSION }} ${{ github.event.inputs.TARGET_REGISTRY }}/${{ github.event.inputs.TARGET_REPOSITORY }}/${{ github.event.inputs.NEW_NAME }}:${{ github.event.inputs.IMAGE_VERSION }} | |
docker push ${{ github.event.inputs.TARGET_REGISTRY }}/${{ github.event.inputs.TARGET_REPOSITORY }}/${{ github.event.inputs.NEW_NAME }}:${{ github.event.inputs.IMAGE_VERSION }} | |
- name: qyweix send message | |
uses: chf007/action-wechat-work@master | |
env: | |
WECHAT_WORK_BOT_WEBHOOK: ${{secrets.QYWX_ROBOT_URL}} | |
IMAGE_URL: ${{ github.event.inputs.TARGET_REGISTRY }}/${{ github.event.inputs.TARGET_REPOSITORY }}/${{ github.event.inputs.NEW_NAME }}:${{ github.event.inputs.IMAGE_VERSION }} | |
with: | |
msgtype: text | |
content: "镜像同步成功 ${{ env.IMAGE_URL }}" | |