Skip to content

Commit

Permalink
Use shared workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
joschi committed Dec 13, 2023
1 parent a996bdc commit c3ed179
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 62 deletions.
47 changes: 14 additions & 33 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,20 @@
---
name: Build
on: [push, pull_request]
# yamllint disable-line rule:truthy
on:
push:
branches:
- release/*
pull_request:
jobs:
yamllint:
uses: dropwizard/workflows/.github/workflows/yamllint.yml@main
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
java_version: ['8', '11', '17']
os: ['ubuntu-latest']
env:
JAVA_OPTS: "-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: ${{ matrix.java_version }}
cache: 'maven'
- name: Cache SonarCloud packages
if: ${{ env.SONAR_TOKEN != null && env.SONAR_TOKEN != '' && matrix.java_version == '11' }}
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
uses: actions/[email protected]
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Build
run: ./mvnw -B -V -ntp install
- name: Analyze with SonarCloud
if: ${{ env.SONAR_TOKEN != null && env.SONAR_TOKEN != '' && matrix.java_version == '11' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./mvnw -B -V -ntp org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
java-version: ['11', '17', '21']
uses: dropwizard/workflows/.github/workflows/maven.yml@main
secrets: inherit
with:
java-version: ${{ matrix.java-version }}
34 changes: 5 additions & 29 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,11 @@
---
name: Release
# yamllint disable-line rule:truthy
on:
push:
tags:
- 'v*'
- v*
jobs:
release:
runs-on: 'ubuntu-latest'
env:
JAVA_OPTS: "-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
steps:
- uses: actions/[email protected]
- name: Set up JDK
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '8'
cache: 'maven'
server-id: sonatype-nexus-staging
server-username: CI_DEPLOY_USERNAME
server-password: CI_DEPLOY_PASSWORD
gpg-passphrase: GPG_PASSPHRASE
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
- uses: actions/[email protected]
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build and Deploy
run: ./mvnw -B -V -ntp -DperformRelease=true deploy
env:
CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }}
CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
uses: dropwizard/workflows/.github/workflows/release.yml@main
secrets: inherit
22 changes: 22 additions & 0 deletions .github/workflows/trigger-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
# yamllint disable rule:comments rule:line-length
name: Trigger Release
# yamllint disable-line rule:truthy
on:
workflow_dispatch:
inputs:
releaseVersion:
description: Version of the next release
required: true
type: string
developmentVersion:
description: Version of the next development cycle (must end in "-SNAPSHOT")
required: true
type: string
jobs:
release:
uses: dropwizard/workflows/.github/workflows/trigger-release.yml@main
secrets: inherit
with:
releaseVersion: ${{ inputs.releaseVersion }}
developmentVersion: ${{ inputs.developmentVersion }}

0 comments on commit c3ed179

Please sign in to comment.