Merge pull request #3 from TrustWiseAgent/docker #1
Workflow file for this run
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: Publish Docker | |
on: | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
publish_docker_image: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set env | |
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Login to Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: registry.cn-hangzhou.aliyuncs.com | |
username: ${{ secrets.ALIYUN_REGISTRY_USERNAME }} | |
password: ${{ secrets.ALIYUN_REGISTRY_PASSWORD }} | |
- name: Build, tag, and push the image to Aliyun registry | |
id: build-image | |
env: | |
ALIYUN_REGISTRY: "registry.cn-hangzhou.aliyuncs.com" | |
ALIYUN_REPOSITORY: kenplusplus/gentrade_server | |
IMAGE_TAG: ${{ env.RELEASE_VERSION }} | |
run: | | |
docker build --no-cache -t $ALIYUN_REGISTRY/$ALIYUN_REPOSITORY:$IMAGE_TAG . | |
docker push $ALIYUN_REGISTRY/$ALIYUN_REPOSITORY:$IMAGE_TAG | |
docker tag $ALIYUN_REGISTRY/$ALIYUN_REPOSITORY:$IMAGE_TAG $ALIYUN_REGISTRY/$ALIYUN_REPOSITORY:latest | |
docker push $ALIYUN_REGISTRY/$ALIYUN_REPOSITORY:latest |