Skip to content

Fix protobuf-spi-impl configuration #86

Fix protobuf-spi-impl configuration

Fix protobuf-spi-impl configuration #86

Workflow file for this run

name: Build
on:
push:
branches: [master]
tags: ['[0-9]+.[0-9]+.[0-9]+']
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Set up JDK
uses: actions/setup-java@v5
with:
distribution: 'liberica'
java-version: '17'
- name: Cache Gradle packages
uses: actions/cache@v6
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build and test
run: ./gradlew build test --info
- name: Upload build artifacts
uses: actions/upload-artifact@v7
with:
name: build-artifacts
path: |
build/reports/jacoco/
build/jacoco/
build/classes/java/
retention-days: 1
sonarcloud:
name: SonarCloud Analysis
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v5
with:
distribution: 'liberica'
java-version: '17'
- name: Cache Gradle packages
uses: actions/cache@v6
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Cache SonarCloud packages
uses: actions/cache@v6
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Download build artifacts
uses: actions/download-artifact@v8
with:
name: build-artifacts
path: build/
- name: SonarCloud analysis
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew sonarqube --info
publish-gradle-portal:
name: Publish to Gradle Plugin Portal
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: [build, sonarcloud]
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Verify tag is on master
run: |
git fetch origin master
if ! git branch -r --contains ${{ github.sha }} | grep -q 'origin/master'; then
echo "Error: Tag is not on master branch"
exit 1
fi
- name: Set up JDK
uses: actions/setup-java@v5
with:
distribution: 'liberica'
java-version: '17'
- name: Cache Gradle packages
uses: actions/cache@v6
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Set version from tag
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Publish to Gradle Plugin Portal
env:
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
run: ./gradlew publishPlugins
publish-maven-central:
name: Publish to Maven Central
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: [build, sonarcloud]
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Verify tag is on master
run: |
git fetch origin master
if ! git branch -r --contains ${{ github.sha }} | grep -q 'origin/master'; then
echo "Error: Tag is not on master branch"
exit 1
fi
- name: Set up JDK
uses: actions/setup-java@v5
with:
distribution: 'liberica'
java-version: '17'
- name: Cache Gradle packages
uses: actions/cache@v6
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Set version from tag
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Publish to Maven Central
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_TOKEN_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_TOKEN_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
run: ./gradlew publishToMavenCentral
create-release:
name: Create GitHub Release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: [publish-gradle-portal, publish-maven-central]
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ github.ref_name }} \
--title "${{ github.ref_name }}" \
--generate-notes