diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 8d0e369..a6136e2 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -4,7 +4,11 @@ on: push: branches: - master - - v1.0 + pull_request: + branches: + - master + release: + types: [ published ] jobs: test: @@ -24,6 +28,7 @@ jobs: run: go test -v ./... deploy: + if: ${{ github.event_name == 'push' || github.event_name == 'release' }} needs: test runs-on: ubuntu-latest steps: @@ -40,15 +45,15 @@ jobs: password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push from mater - if: ${{ github.ref == 'refs/heads/master' }} + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} uses: docker/build-push-action@v2 with: push: true tags: updev/polkovnik-bot:latest - - name: Build and push from v1 - if: ${{ github.ref == 'refs/heads/v1.0' }} + - name: Build and push by release + if: ${{ github.event_name == 'release' }} uses: docker/build-push-action@v2 with: push: true - tags: updev/polkovnik-bot:v1 \ No newline at end of file + tags: updev/polkovnik-bot:${{ github.event.release.tag_name }} \ No newline at end of file