name: 'UI: Bump Version' on: release: types: - 'published' concurrency: group: ${{ github.workflow }}-${{ github.event.release.tag_name }} cancel-in-progress: false env: PROWLER_VERSION: ${{ github.event.release.tag_name }} BASE_BRANCH: master jobs: detect-release-type: runs-on: ubuntu-latest timeout-minutes: 5 permissions: contents: read outputs: is_minor: ${{ steps.detect.outputs.is_minor }} is_patch: ${{ steps.detect.outputs.is_patch }} major_version: ${{ steps.detect.outputs.major_version }} minor_version: ${{ steps.detect.outputs.minor_version }} patch_version: ${{ steps.detect.outputs.patch_version }} steps: - name: Detect release type and parse version id: detect run: | if [[ $PROWLER_VERSION =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then MAJOR_VERSION=${BASH_REMATCH[1]} MINOR_VERSION=${BASH_REMATCH[2]} PATCH_VERSION=${BASH_REMATCH[3]} echo "major_version=${MAJOR_VERSION}" >> "${GITHUB_OUTPUT}" echo "minor_version=${MINOR_VERSION}" >> "${GITHUB_OUTPUT}" echo "patch_version=${PATCH_VERSION}" >> "${GITHUB_OUTPUT}" if (( MAJOR_VERSION != 5 )); then echo "::error::Releasing another Prowler major version, aborting..." exit 1 fi if (( PATCH_VERSION == 0 )); then echo "is_minor=true" >> "${GITHUB_OUTPUT}" echo "is_patch=false" >> "${GITHUB_OUTPUT}" echo "✓ Minor release detected: $PROWLER_VERSION" else echo "is_minor=false" >> "${GITHUB_OUTPUT}" echo "is_patch=true" >> "${GITHUB_OUTPUT}" echo "✓ Patch release detected: $PROWLER_VERSION" fi else echo "::error::Invalid version syntax: '$PROWLER_VERSION' (must be X.Y.Z)" exit 1 fi bump-minor-version: needs: detect-release-type if: needs.detect-release-type.outputs.is_minor == 'true' runs-on: ubuntu-latest timeout-minutes: 15 permissions: contents: read pull-requests: write steps: - name: Checkout repository uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - name: Calculate next minor version run: | MAJOR_VERSION=${{ needs.detect-release-type.outputs.major_version }} MINOR_VERSION=${{ needs.detect-release-type.outputs.minor_version }} NEXT_MINOR_VERSION=${MAJOR_VERSION}.$((MINOR_VERSION + 1)).0 echo "NEXT_MINOR_VERSION=${NEXT_MINOR_VERSION}" >> "${GITHUB_ENV}" echo "Current version: $PROWLER_VERSION" echo "Next minor version: $NEXT_MINOR_VERSION" - name: Bump UI version in .env for master run: | set -e sed -i "s|NEXT_PUBLIC_PROWLER_RELEASE_VERSION=v${PROWLER_VERSION}|NEXT_PUBLIC_PROWLER_RELEASE_VERSION=v${NEXT_MINOR_VERSION}|" .env echo "Files modified:" git --no-pager diff - name: Create PR for next minor version to master uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 with: author: prowler-bot <179230569+prowler-bot@users.noreply.github.com> token: ${{ secrets.PROWLER_BOT_ACCESS_TOKEN }} base: master commit-message: 'chore(ui): Bump version to v${{ env.NEXT_MINOR_VERSION }}' branch: ui-version-bump-to-v${{ env.NEXT_MINOR_VERSION }} title: 'chore(ui): Bump version to v${{ env.NEXT_MINOR_VERSION }}' labels: no-changelog,skip-sync body: | ### Description Bump Prowler UI version to v${{ env.NEXT_MINOR_VERSION }} after releasing Prowler v${{ env.PROWLER_VERSION }}. ### Files Updated - `.env`: `NEXT_PUBLIC_PROWLER_RELEASE_VERSION` ### License By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. - name: Checkout version branch uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: ref: v${{ needs.detect-release-type.outputs.major_version }}.${{ needs.detect-release-type.outputs.minor_version }} - name: Calculate first patch version run: | MAJOR_VERSION=${{ needs.detect-release-type.outputs.major_version }} MINOR_VERSION=${{ needs.detect-release-type.outputs.minor_version }} FIRST_PATCH_VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.1 VERSION_BRANCH=v${MAJOR_VERSION}.${MINOR_VERSION} echo "FIRST_PATCH_VERSION=${FIRST_PATCH_VERSION}" >> "${GITHUB_ENV}" echo "VERSION_BRANCH=${VERSION_BRANCH}" >> "${GITHUB_ENV}" echo "First patch version: $FIRST_PATCH_VERSION" echo "Version branch: $VERSION_BRANCH" - name: Bump UI version in .env for version branch run: | set -e sed -i "s|NEXT_PUBLIC_PROWLER_RELEASE_VERSION=v${PROWLER_VERSION}|NEXT_PUBLIC_PROWLER_RELEASE_VERSION=v${FIRST_PATCH_VERSION}|" .env echo "Files modified:" git --no-pager diff - name: Create PR for first patch version to version branch uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 with: author: prowler-bot <179230569+prowler-bot@users.noreply.github.com> token: ${{ secrets.PROWLER_BOT_ACCESS_TOKEN }} base: ${{ env.VERSION_BRANCH }} commit-message: 'chore(ui): Bump version to v${{ env.FIRST_PATCH_VERSION }}' branch: ui-version-bump-to-v${{ env.FIRST_PATCH_VERSION }} title: 'chore(ui): Bump version to v${{ env.FIRST_PATCH_VERSION }}' labels: no-changelog,skip-sync body: | ### Description Bump Prowler UI version to v${{ env.FIRST_PATCH_VERSION }} in version branch after releasing Prowler v${{ env.PROWLER_VERSION }}. ### Files Updated - `.env`: `NEXT_PUBLIC_PROWLER_RELEASE_VERSION` ### License By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. bump-patch-version: needs: detect-release-type if: needs.detect-release-type.outputs.is_patch == 'true' runs-on: ubuntu-latest timeout-minutes: 15 permissions: contents: read pull-requests: write steps: - name: Checkout repository uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - name: Calculate next patch version run: | MAJOR_VERSION=${{ needs.detect-release-type.outputs.major_version }} MINOR_VERSION=${{ needs.detect-release-type.outputs.minor_version }} PATCH_VERSION=${{ needs.detect-release-type.outputs.patch_version }} NEXT_PATCH_VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.$((PATCH_VERSION + 1)) VERSION_BRANCH=v${MAJOR_VERSION}.${MINOR_VERSION} echo "NEXT_PATCH_VERSION=${NEXT_PATCH_VERSION}" >> "${GITHUB_ENV}" echo "VERSION_BRANCH=${VERSION_BRANCH}" >> "${GITHUB_ENV}" echo "Current version: $PROWLER_VERSION" echo "Next patch version: $NEXT_PATCH_VERSION" echo "Target branch: $VERSION_BRANCH" - name: Bump UI version in .env for version branch run: | set -e sed -i "s|NEXT_PUBLIC_PROWLER_RELEASE_VERSION=v${PROWLER_VERSION}|NEXT_PUBLIC_PROWLER_RELEASE_VERSION=v${NEXT_PATCH_VERSION}|" .env echo "Files modified:" git --no-pager diff - name: Create PR for next patch version to version branch uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 with: author: prowler-bot <179230569+prowler-bot@users.noreply.github.com> token: ${{ secrets.PROWLER_BOT_ACCESS_TOKEN }} base: ${{ env.VERSION_BRANCH }} commit-message: 'chore(ui): Bump version to v${{ env.NEXT_PATCH_VERSION }}' branch: ui-version-bump-to-v${{ env.NEXT_PATCH_VERSION }} title: 'chore(ui): Bump version to v${{ env.NEXT_PATCH_VERSION }}' labels: no-changelog,skip-sync body: | ### Description Bump Prowler UI version to v${{ env.NEXT_PATCH_VERSION }} after releasing Prowler v${{ env.PROWLER_VERSION }}. ### Files Updated - `.env`: `NEXT_PUBLIC_PROWLER_RELEASE_VERSION` ### License By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.