This repository was archived by the owner on Jan 1, 2026. It is now read-only.
Improvements to the authentication and registration system #31
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: Suggest Version Bump | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| statuses: read | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - 'database/**/*.sql' | |
| workflow_call: | |
| outputs: | |
| next_version: | |
| description: 'The next suggested version' | |
| value: ${{ jobs.suggest-bump.outputs.next_version }} | |
| jobs: | |
| get-labels: | |
| name: Get PR Labels | |
| uses: ./.github/workflows/get-pr-labels.yml | |
| suggest-bump: | |
| name: Suggest Version Bump | |
| needs: get-labels | |
| runs-on: ubuntu-latest | |
| outputs: | |
| next_version: ${{ steps.next_version.outputs.next_version }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Determine bump type | |
| id: bump | |
| run: | | |
| LABELS="${{ needs.get-labels.outputs.labels }}" | |
| BUMP="patch" | |
| echo "$LABELS" | grep -q 'type: feature' && BUMP="minor" | |
| echo "$LABELS" | grep -q 'type: security' && BUMP="minor" | |
| echo "$LABELS" | grep -q 'type: breaking' && BUMP="major" | |
| echo "bump=$BUMP" >> "$GITHUB_OUTPUT" | |
| - name: Get latest tag | |
| id: latest_tag | |
| run: | | |
| TAG=$(git tag --list 'v*' --sort=-v:refname | head -n1) | |
| echo "tag=$TAG" >> "$GITHUB_OUTPUT" | |
| - name: Calculate next version | |
| id: next_version | |
| run: | | |
| TAG="${{ steps.latest_tag.outputs.tag }}" | |
| BUMP="${{ steps.bump.outputs.bump }}" | |
| if [ -z "$TAG" ]; then | |
| TAG="v0.0.0" | |
| fi | |
| VERSION=$(echo "$TAG" | sed -E 's/^v([0-9]+\.[0-9]+\.[0-9]+).*/\1/') | |
| PRERELEASE=$(echo "$TAG" | sed -nE 's/^v[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9.-]+)?$/\1/p') | |
| IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION" | |
| case "$BUMP" in | |
| major) MAJOR=$((MAJOR + 1)); MINOR=0; PATCH=0 ;; | |
| minor) MINOR=$((MINOR + 1)); PATCH=0 ;; | |
| patch) PATCH=$((PATCH + 1)) ;; | |
| esac | |
| if [ -n "$PRERELEASE" ]; then | |
| NEXT_VERSION="v${MAJOR}.${MINOR}.${PATCH}${PRERELEASE}" | |
| else | |
| NEXT_VERSION="v${MAJOR}.${MINOR}.${PATCH}" | |
| fi | |
| echo "next_version=$NEXT_VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Report summary | |
| run: | | |
| { | |
| echo "### 🚀 Suggested Version Bump: **${{ steps.bump.outputs.bump }}**" | |
| echo "#### Latest tag: \`${{ steps.latest_tag.outputs.tag }}\`" | |
| echo "#### Next version: \`${{ steps.next_version.outputs.next_version }}\`" | |
| } >> "$GITHUB_STEP_SUMMARY" |