Bump Flyway Community DB Support to 10.25.14 #296
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: Deploy Flyway Community DB Support to Github Packages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| if: github.actor != 'flyway-flyway-github-actions[bot]' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: write | |
| packages: write | |
| steps: | |
| - name: Retrieve GitHub App credentials from Vault | |
| if: github.ref == 'refs/heads/main' | |
| uses: hashicorp/vault-action@v3.3.0 | |
| id: vault | |
| with: | |
| method: jwt | |
| path: gha_jwt | |
| url: ${{ vars.VAULT_URL }} | |
| role: flyway-community-db-support-gha | |
| secrets: | | |
| build-secrets/data/shared/gha_app_flyway_flyway app_id | APP_ID ; | |
| build-secrets/data/shared/gha_app_flyway_flyway private_key | APP_PRIVATE_KEY | |
| - name: Generate GitHub App Token | |
| if: github.ref == 'refs/heads/main' | |
| id: app-token | |
| uses: actions/create-github-app-token@v3.1.1 | |
| with: | |
| app-id: ${{ steps.vault.outputs.APP_ID }} | |
| private-key: ${{ steps.vault.outputs.APP_PRIVATE_KEY }} | |
| owner: flyway | |
| - name: Checkout Flyway Community DB Support | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| token: ${{ steps.app-token.outputs.token || github.token }} | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 17 | |
| distribution: 'temurin' | |
| cache: 'maven' | |
| - name: Build with Maven | |
| run: mvn -B install --file pom.xml | |
| - name: Configure Git | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| git config user.name "rg-buildmonkey" | |
| git config user.email "github-buildmonkey@red-gate.com" | |
| - name: Bump versions | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1) 2>/dev/null || echo "") | |
| CURRENT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
| # Manual override for major bumps | |
| if [ -n "$LATEST_TAG" ] && [ "$CURRENT_VERSION" != "$LATEST_TAG" ]; then | |
| echo "Tagging and skipping auto-bump: Version manually changed to $CURRENT_VERSION" | |
| git tag "$CURRENT_VERSION" | |
| git push --tags | |
| exit 0 | |
| fi | |
| # Minor/patch bumping | |
| if [ -n "$LATEST_TAG" ] && git diff --diff-filter=ADR --name-only "$LATEST_TAG"..HEAD -- '*pom.xml' | grep -q pom.xml; then | |
| NEW_VERSION=$(echo "$CURRENT_VERSION" | awk -F'[.-]' '{print $1"."$2+1".0"}') | |
| else | |
| NEW_VERSION=$(echo "$CURRENT_VERSION" | awk -F'[.-]' '{print $1"."$2"."$3+1}') | |
| fi | |
| echo "Bumping version: $CURRENT_VERSION -> $NEW_VERSION" | |
| mvn versions:set -DnewVersion=$NEW_VERSION | |
| mvn versions:set -DnewVersion=$NEW_VERSION -pl flyway-community-db-support-archetype | |
| git add '*pom.xml' | |
| git commit -m "Bump Flyway Community DB Support to $NEW_VERSION" | |
| git tag "$NEW_VERSION" | |
| git push | |
| git push --tags | |
| - name: Publish to GitHub Packages Apache Maven | |
| if: github.ref == 'refs/heads/main' | |
| run: mvn -B jar:jar deploy:deploy -Pgithub -s $GITHUB_WORKSPACE/settings.xml -pl '!flyway-community-db-support-archetype' | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| - name: Publish Archetype to GitHub Packages Apache Maven | |
| if: github.ref == 'refs/heads/main' | |
| run: mvn -B jar:jar deploy:deploy -Pgithub -s $GITHUB_WORKSPACE/settings.xml -pl flyway-community-db-support-archetype | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} |