From 42159dce4d321ea810fc6257f7b92568cd40ffd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A0=20Casaj=C3=BAs?= Date: Wed, 11 May 2022 16:33:24 +0200 Subject: [PATCH] Run docker build only once and also on tag --- .github/workflows/main.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d1348b6b..cafd33bb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,7 +3,7 @@ name: Run tests & Publish to Docker Registry on: [push, pull_request] jobs: - build: + test: runs-on: ubuntu-latest strategy: max-parallel: 4 @@ -93,8 +93,13 @@ jobs: name: code-coverage-report path: htmlcov + build: + runs-on: ubuntu-latest + needs: ['test'] + + steps: - name: Publish to Docker Registry - if: github.event_name == 'push' && github.ref == 'refs/heads/master' + if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) uses: docker/build-push-action@v1 with: repository: simplelogin/app-ci @@ -103,7 +108,7 @@ jobs: tag_with_ref: true - name: Create Sentry release - if: github.event_name == 'push' && github.ref == 'refs/heads/master' + if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) uses: getsentry/action-release@v1 env: SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}