Skip to content

Improve datasource unwrapping for flyway autoconfiguration (#102) #2

Improve datasource unwrapping for flyway autoconfiguration (#102)

Improve datasource unwrapping for flyway autoconfiguration (#102) #2

Workflow file for this run

name: Snapshot
on:
push:
branches:
- master
tags-ignore:
- '*'
jobs:
publish:
if: github.repository == 'gavlyukovskiy/spring-boot-data-source-decorator'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: git fetch --prune --unshallow --tags
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- id: get-snapshot-version
name: Generate snapshot version
shell: bash
run: |
version=$(git describe --tag --abbrev=0 | cut -c 2-)
regex="^([0-9]+).([0-9]+).([0-9]+)$"
if [[ $version =~ $regex ]]; then
major="${BASH_REMATCH[1]}"
minor="${BASH_REMATCH[2]}"
patch="${BASH_REMATCH[3]}"
patch=$(($patch + 1))
snapshot_version="${major}.${minor}.${patch}"
if ! [[ $snapshot_version =~ $regex ]]; then
echo "SNAPSHOT version $snapshot_version is not a valid SemVer"
exit 1
fi
echo "${snapshot_version}-SNAPSHOT"
echo "snapshot-version=${snapshot_version}-SNAPSHOT" >> $GITHUB_OUTPUT
else
echo "Version $version is not a valid SemVer"
exit 1
fi
- name: Build with Gradle
run: ./gradlew -Pversion=${{ steps.get-snapshot-version.outputs.snapshot-version }} build
- name: Upload snapshot artifacts to Sonatype
id: upload_snapshot_artifacts
env:
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_KEY: ${{ secrets.GPG_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: ./gradlew -Pversion=${{ steps.get-snapshot-version.outputs.snapshot-version }} publishToSonatype closeAndReleaseSonatypeStagingRepository