Skip to content

Manual Push Aliyun Image Registry #3

Manual Push Aliyun Image Registry

Manual Push Aliyun Image Registry #3

name: Manual Push Aliyun Image Registry
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag for the Docker image'
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to Alibaba Cloud Container Registry
env:
REGISTRY: ${{ secrets.ALIYUN_REGISTRY }}
USERNAME: ${{ secrets.ALIYUN_USERNAME }}
PASSWORD: ${{ secrets.ALIYUN_PASSWORD }}
run: echo "${{ secrets.ALIYUN_PASSWORD }}" | docker login ${{ env.REGISTRY }} -u ${{ secrets.ALIYUN_USERNAME }} --password-stdin
- name: Extract branch name
id: extract_branch
run: echo "branch_name=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Build and Push Docker image
env:
## 修改为你对应的镜像名称
IMAGE_NAME: ${{ secrets.ALIYUN_REGISTRY }}/xdbin/beancount-gs
TAG: ${{ github.event.inputs.tag }}
run: |
docker build -t $IMAGE_NAME:$TAG .
docker push $IMAGE_NAME:$TAG