From 671555af5d81fe9aa9c8ac0993483b90bad6987f Mon Sep 17 00:00:00 2001 From: zhilong0224 <85558580+zhilong0224@users.noreply.github.com> Date: Thu, 13 Jan 2022 17:01:25 +0800 Subject: [PATCH] Update release.yml --- .github/workflows/release.yml | 52 +++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 99861fc..0c47813 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,10 +1,10 @@ name: Release on: - push: - branches: [ master ] - pull_request: + release: + types: [published] branches: [ master ] + jobs: build_assets: @@ -115,3 +115,49 @@ jobs: npc_syno.spk env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + build_docker: + + runs-on: ubuntu-latest + steps: + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + - name: Set env + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push nps + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile.nps + platforms: linux/amd64,linux/arm,linux/arm64 + push: true + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/nps:latest + ${{ secrets.DOCKERHUB_USERNAME }}/nps:${{ env.RELEASE_VERSION }} + - name: Build and push npc + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile.npc + platforms: linux/amd64,linux/arm,linux/arm64 + push: true + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/npc:latest + ${{ secrets.DOCKERHUB_USERNAME }}/npc:${{ env.RELEASE_VERSION }}