Create build #2
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: Docker Image CI | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build the Docker image | |
run: | | |
docker login --username=springhgui0127 registry.cn-hangzhou.aliyuncs.com --password=${{ secrets.PASSWORD }} | |
version=$(grep "<Version>" src/Directory.Build.props | awk -F'[<>]' '{print $3}') | |
echo $version | |
appName=registry.cn-hangzhou.aliyuncs.com/hgui/opentask | |
tag=$appName:$version-$(date +%s) | |
latestTag=$appName:latest | |
echo $tag | |
docker build . --file Dockerfile --tag $tag | |
docker push $tag | |
docker tag $tag $latestTag | |
docker push $latestTag | |