From cf4ed8a4d57076efd8b41a845a537e1c2a1f16c3 Mon Sep 17 00:00:00 2001 From: ppodds Date: Fri, 16 Sep 2022 17:54:21 +0800 Subject: [PATCH] chore: move push image to cd.yml --- .github/workflows/cd.yml | 32 ++++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 18 ------------------ 2 files changed, 32 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/cd.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..9754387 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,32 @@ +name: CD + +on: + release: + types: [released] + +jobs: + test: + uses: ./.github/workflows/test.yml + docker: + needs: test + runs-on: ubuntu-latest + name: "Build Docker image and push to Docker Hub" + steps: + - name: Get version string + id: get-version + run: | + tag=${{github.event.release.tag_name}} + echo "::set-output name=version::${tag:1}" + - uses: actions/checkout@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v3 + with: + push: true + tags: ppodds/ncuplus-backend:latest,ppodds/ncuplus-backend:${{ steps.get-version.outputs.version }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb34e7a..575a795 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,21 +7,3 @@ on: jobs: test: uses: ./.github/workflows/test.yml - docker: - needs: test - runs-on: ubuntu-latest - name: "Build Docker image and push to Docker Hub" - steps: - - uses: actions/checkout@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v3 - with: - push: true - tags: ppodds/ncuplus-backend:latest