diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml new file mode 100644 index 000000000..ceebc8f8d --- /dev/null +++ b/.github/workflows/docker-release.yml @@ -0,0 +1,26 @@ +name: Build and push Docker image +on: + release: + types: [published] + +jobs: + build-and-push: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + push: true + tags: star7th/showdoc:${{ github.event.release.tag_name }} diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 879a93eef..61abbe986 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -4,8 +4,6 @@ on: push: branches: - "master" - tags: - - "v*.*.*" # 匹配以 v 开头,后跟三个数字的标签 jobs: docker: @@ -25,7 +23,4 @@ jobs: uses: docker/build-push-action@v2 with: push: true - tags: - - star7th/showdoc:latest - - star7th/showdoc:${{ github.ref }} - - star7th/showdoc:${{ github.ref | replace('refs/tags/','') }} + tags: star7th/showdoc:latest