Skip to content

build: Gradle Version Refactoring #3

build: Gradle Version Refactoring

build: Gradle Version Refactoring #3

Workflow file for this run

name: Publish
on:
push:
branches:
- master
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set-vars.outputs.version }}
missing: ${{ steps.set-vars.outputs.missing }}
steps:
- name: Checkout
uses: actions/checkout@v4
- id: set-vars
name: Set variables
run: |
version=$(grep "project = " gradle/libs.versions.toml | awk '{ print $3 }' | tr -d \''"\\')
missing=$(if [ "$(git ls-remote origin refs/tags/$version)" ]; then echo false; else echo true; fi)
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "missing=$missing" >> "$GITHUB_OUTPUT"
publish:
needs: prepare
if: needs.prepare.outputs.missing == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v3
- name: Update Gradle Wrapper Script Permissions
run: chmod +x gradlew
- name: Build with Gradle Wrapper
run: ./gradlew clean build --info
- name: Release
uses: ncipollo/release-action@v1
with:
tag: ${{ needs.prepare.outputs.version }}
skipIfReleaseExists: true
allowUpdates: true
makeLatest: latest
- name: Publish Gradle Plugin
run: >
./gradlew publishPlugins --info
-Pgradle.publish.key=${{ secrets.GRADLE_PUBLISH_KEY }}
-Pgradle.publish.secret=${{ secrets.GRADLE_PUBLISH_SECRET }}