Skip to content

Remove redundant code in snippet #75

Remove redundant code in snippet

Remove redundant code in snippet #75

name: Build and Publish
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
types: [opened, synchronize, reopened]
permissions:
contents: write
pull-requests: write
jobs:
gradle-build:
name: Build project with Gradle
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
add-job-summary-as-pr-comment: on-failure
build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-use-agree: "yes"
dependency-graph: generate-and-submit
- name: Cache SonarQube packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Run CI build
run: ./gradlew build
- name: Publish test coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew jacocoTestReport sonar
asciidoc-build:
# The type of runner that the job will run on
name: Generate articles with Ascii Doctor
runs-on: ubuntu-latest
needs: gradle-build
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
# Includes the AsciiDoctor GitHub Pages Action to convert adoc files to html and publish to gh-pages branch
- name: asciidoctor-ghpages
uses: manoelcampos/asciidoctor-ghpages-action@v2