Set project version to SNAPSHOT until released #2
This file contains 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: "Java CI" | |
on: | |
push: | |
branches: | |
- '[5-9].[0-9].x' | |
pull_request: | |
types: [ opened, reopened, synchronize ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
java: ['17', '21'] | |
steps: | |
- name: "π₯ Checkout the repository" | |
uses: actions/checkout@v4 | |
- name: "βοΈ Setup JDK" | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'liberica' | |
java-version: ${{ matrix.java }} | |
- name: "π Setup Gradle" | |
uses: gradle/actions/setup-gradle@v4 | |
- name: "π¨ Run Base Tests" | |
run: ./gradlew check --continue | |
- name: "π¨ Run Example App to confirm it does not fail" | |
working-directory: examples/mysql | |
run: ./gradlew bootRun | |
publish: | |
if: github.event_name == 'push' | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # publishing docs | |
pages: write | |
steps: | |
- name: "π₯ Checkout the repository" | |
uses: actions/checkout@v4 | |
- name: "βοΈ Setup JDK" | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'liberica' | |
java-version: '17' | |
- name: "π Setup Gradle" | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Read project version | |
id: version | |
run: | | |
# Extract the version from the property file. | |
version=$(grep '^projectVersion=' gradle.properties | cut -d= -f2) | |
echo "version=$version" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: "π€ Publish to Snapshot" | |
if: ${{ success() && endsWith( steps.version.outputs.version, '-SNAPSHOT' ) }} | |
env: | |
MAVEN_PUBLISH_USERNAME: ${{ secrets.MAVEN_PUBLISH_USERNAME }} | |
MAVEN_PUBLISH_PASSWORD: ${{ secrets.MAVEN_PUBLISH_PASSWORD }} | |
MAVEN_PUBLISH_URL: ${{ secrets.MAVEN_PUBLISH_SNAPSHOT_URL }} | |
GRAILS_PUBLISH_RELEASE: "false" | |
working-directory: ./plugin | |
run: ../gradlew publish | |
- name: "π Generate User Guide Documentation" | |
if: success() | |
run: ./gradlew docs | |
- name: "π Publish to Github Pages" | |
if: ${{ success() && endsWith( steps.version.outputs.version, '-SNAPSHOT' ) }} | |
uses: grails/github-pages-deploy-action@grails | |
env: | |
BRANCH: gh-pages | |
COMMIT_EMAIL: ${{ env.GIT_USER_EMAIL }} | |
COMMIT_NAME: ${{ env.GIT_USER_NAME }} | |
FOLDER: build/docs | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
TARGET_REPOSITORY: ${{ github.repository }} | |
DOC_FOLDER: gh-pages |