From 14c59175e5ed8c3c09b69a4d67aef6e606bff6f4 Mon Sep 17 00:00:00 2001 From: syrosh Date: Fri, 13 Jun 2025 17:38:35 +0200 Subject: [PATCH] chore(ci): don't build on version bump --- .github/workflows/push-main.yml | 42 +++++++++++++++++++++++---- .internal/ci/init-openldap.sh | 2 +- extension/.internal/scripts/import.sh | 2 +- 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/.github/workflows/push-main.yml b/.github/workflows/push-main.yml index 765a710..3150223 100644 --- a/.github/workflows/push-main.yml +++ b/.github/workflows/push-main.yml @@ -8,9 +8,34 @@ permissions: contents: read jobs: + check-bump: + name: Check bump + runs-on: ubuntu-latest + outputs: + is-bump: ${{ steps.check-bump.outputs.is-bump }} + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Check Bump + id: check-bump + run: | + msg="$(git log -1 --pretty=%B)" + echo "message=$msg" >> $GITHUB_OUTPUT + + if [[ "$msg" == bump:* ]]; then + echo "is-bump=true" >> $GITHUB_OUTPUT + else + echo "is-bump=false" >> $GITHUB_OUTPUT + fi + version: name: Version runs-on: ubuntu-latest + needs: [check-bump] + if: needs.check-bump.outputs.is-bump == 'false' outputs: version: ${{ steps.next-version.outputs.version }} steps: @@ -18,19 +43,24 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Setup Pyhon uses: actions/setup-python@v5 + with: python-version: '3.13' + - name: Install Commitizen run: ./.internal/ci/install-cz.sh + - name: Determine Next Version id: next-version run: echo "version=$(./.internal/ci/version-next.sh)" >> $GITHUB_OUTPUT build-theme: name: Build Theme - needs: [version] + needs: [check-bump, version] + if: needs.version.outputs.version != '' && needs.check-bump.outputs.is-bump == 'false' runs-on: ubuntu-latest steps: - name: Checkout Repo @@ -64,7 +94,8 @@ jobs: build-extension: name: Build Extension runs-on: ubuntu-latest - needs: [version] + needs: [check-bump, version] + if: needs.version.outputs.version != '' && needs.check-bump.outputs.is-bump == 'false' outputs: extension-artifact-name: ${{ steps.upload.outputs.artifact-name }} steps: @@ -102,7 +133,8 @@ jobs: test-e2e: name: Test E2E runs-on: ubuntu-latest - needs: [build-theme, build-extension] + needs: [check-bump, version, build-theme, build-extension] + if: needs.version.outputs.version != '' && needs.check-bump.outputs.is-bump == 'false' env: THEME_PATH: ./keycloak-app-passwords-theme.jar EXTENSION_PATH: ./keycloak-app-passwords-extension.jar @@ -158,8 +190,8 @@ jobs: release: name: Release runs-on: ubuntu-latest - needs: [version, test-e2e] - if: needs.version.outputs.version != '' + needs: [check-bump, version, test-e2e] + if: needs.version.outputs.version != '' && needs.check-bump.outputs.is-bump == 'false' environment: release permissions: contents: write diff --git a/.internal/ci/init-openldap.sh b/.internal/ci/init-openldap.sh index 08f5e0d..65d1129 100755 --- a/.internal/ci/init-openldap.sh +++ b/.internal/ci/init-openldap.sh @@ -11,7 +11,7 @@ for i in {1..30}; do break fi echo "Waiting for LDAP... ($i)" - sleep 1 + sleep 2 done docker exec openldap sh -c 'cd /tmp/ldapscripts && sh add-schema.sh' diff --git a/extension/.internal/scripts/import.sh b/extension/.internal/scripts/import.sh index 54cdccc..62dcc0a 100755 --- a/extension/.internal/scripts/import.sh +++ b/extension/.internal/scripts/import.sh @@ -12,7 +12,7 @@ for i in {1..30}; do break fi echo "Waiting for LDAP... ($i)" - sleep 1 + sleep 2 done docker compose run --rm \