From 7d079de7e4a7631cd8cb152383be55cd3ca5a403 Mon Sep 17 00:00:00 2001 From: j_hao104 Date: Fri, 31 Dec 2021 13:57:20 +0800 Subject: [PATCH] [update] :mouse: docker ci test --- .github/workflows/docker-image.yml | 42 +++++++++++++++++++----------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index db1a7107d..9f30cec2c 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,23 +1,35 @@ -name: Docker Image CI +name: Publish Docker image on: - push: - branches: [ master ] - pull_request: - branches: [ master ] + release: + types: [published] jobs: - build: - + push_to_registry: + name: Push Docker image to Docker Hub runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Build the Docker image - run: docker build . --file Dockerfile --tag jhao104/proxy_pool:$(date +%s) - - name: DockerHub Login - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Log in to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v3 + with: + images: jhao104/proxy_pool + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}