diff --git a/.gitea/workflows/build_and_deploy.yml b/.gitea/workflows/build_and_deploy.yml index 7b0788e..af04ee2 100644 --- a/.gitea/workflows/build_and_deploy.yml +++ b/.gitea/workflows/build_and_deploy.yml @@ -3,6 +3,12 @@ # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions # https://docs.github.com/en/actions/learn-github-actions/contexts#github-context +# Configurable with a few commit messages: +# - [skip-tests] Skip the test stage +# - [skip-deployment] Skip the deployment stage +# - [skip-ci] Skip all stages (the whole ci/cd) +# + name: Build Docker and Deploy run-name: Build & Deploy ${{ gitea.ref }} on ${{ gitea.actor }} @@ -16,6 +22,9 @@ jobs: build_server: name: Build Docker Container runs-on: bfb-cicd-latest + if: >- + !contains(github.event.head_commit.message, '[skip-ci]') && + !contains(github.event.head_commit.message, '[skip-deployment]') steps: - run: echo -n "${{ secrets.DOCKER_REG_PASS }}" | docker login registry.blackforestbytes.com -u docker --password-stdin - name: Check out code @@ -27,6 +36,9 @@ jobs: test_server: name: Run Unit-Tests runs-on: bfb-cicd-latest + if: >- + !contains(github.event.head_commit.message, '[skip-ci]') && + !contains(github.event.head_commit.message, '[skip-tests]') steps: - name: Check out code @@ -68,6 +80,12 @@ jobs: name: Deploy to Server needs: [build_server, test_server] runs-on: ubuntu-latest + if: >- + !cancelled() && + !contains(github.event.head_commit.message, '[skip-ci]') && + !contains(github.event.head_commit.message, '[skip-deployment]') && + needs.build_server.result == 'success' && + (needs.test_server.result == 'skipped' || needs.test_server.result == 'success') steps: - name: Execute deploy on remote (via ssh) uses: appleboy/ssh-action@v1.0.0