Skip to content

Commit

Permalink
workflow update
Browse files Browse the repository at this point in the history
  • Loading branch information
FP17639 committed Sep 29, 2023
1 parent c22da6c commit 890a63b
Show file tree
Hide file tree
Showing 3 changed files with 142 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/on_pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Pull request

on:
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven

- name: Check Style
run: mvn checkstyle:check

- name: Build
run: mvn clean compile

- name: Test
run: mvn test

- name: Publish Test Report
if: always()
uses: mikepenz/action-junit-report@v4
with:
report_paths: '**/target/surefire-reports/TEST-*.xml'

- name: Sonar
run: mvn verify sonar:sonar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
49 changes: 49 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Release

on:
push:
tags:
- 'v*.*.*'

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Deploy
run: mvn -B clean deploy -DskipTests -Psign
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

- name: Generate release changelog
uses: mikepenz/[email protected]
id: build_changelog
with:
configuration: 'changelog-builder.json'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create release
uses: ncipollo/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: ${{ steps.build_changelog.outputs.changelog }}
draft: true
prerelease: true
allowUpdates: true
51 changes: 51 additions & 0 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Tag

on:
workflow_dispatch:
inputs:
release_version:
description: 'Release version'
required: true

jobs:
tag:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout project
uses: actions/checkout@v4
with:
token: ${{ secrets.CI_CD_TOKEN }}

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven

- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true

- name: Tag
run: |
mvn versions:set -DnewVersion=${{ github.event.inputs.release_version }}
git add pom.xml
git add **/pom.xml
git commit -s -m "Prepare release v${{ github.event.inputs.release_version }}"
git push
git tag v${{ github.event.inputs.release_version }} -s -m "Create tag v${{ github.event.inputs.release_version }}"
git push origin v${{ github.event.inputs.release_version }}
- name: Update next version
run: |
mvn versions:set -DnextSnapshot=true
git add pom.xml
git add **/pom.xml
git commit -s -m "Prepare next snapshot version [skip ci]"
git push

0 comments on commit 890a63b

Please sign in to comment.