From 2b8f26ebaf839581e956a7a5aefa2fadc2190c2b Mon Sep 17 00:00:00 2001 From: xia <50513568+artxia@users.noreply.github.com> Date: Fri, 9 Apr 2021 19:53:56 +0800 Subject: [PATCH] Update build.yml --- .github/workflows/build.yml | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b5534d5..588219e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,22 +10,37 @@ on: workflow_dispatch: inputs: +env: + IMAGE_NAME: ehforwarderbot-docker + jobs: build: name: build runs-on: ubuntu-latest - timeout-minutes: 5 - - steps: - - - name: Checkout - uses: actions/checkout@v2 - - - name: build and push image - uses: docker/build-push-action@v1 + timeout-minutes: 10 + steps: + - name: Get the version + id: prep + run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} + + - 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.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - repository: artxia/ehforwarderbot-docker - tags: latest + + - name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + push: ${{ startsWith(github.ref, 'refs/tags/') }} + tags: | + ${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}:latest + ${{ secrets.DOCKER_USERNAME }}/${{ env.IMAGE_NAME }}:${{ steps.prep.outputs.VERSION }}