Docker Image CI #102
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: | |
workflow_dispatch: | |
release: | |
types: [published, released, created, edited] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Get version | |
id: get_version | |
run: echo "VERSION=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_ENV | |
- name: Build the Docker image | |
run: | | |
docker version | |
docker login --username=${{ secrets.DOCKER_USERNAME }} --password=${{ secrets.DOCKER_PASSWORD }} | |
# 使用Dockerfile构建镜像 | |
docker build -t zhenorzz/goploy:${{ env.VERSION }} . --file docker/Dockerfile | |
# 推送镜像到镜像仓库 | |
docker push zhenorzz/goploy:${{ env.VERSION }} |