introducing release workflow #98
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Maven CI/CD | |
on: | |
workflow_dispatch: | |
inputs: {} | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
detect-changes: | |
runs-on: ubuntu-latest | |
outputs: | |
modules: ${{ steps.find-modules.outputs.changed_modules }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Identify Changed Modules | |
id: find-modules | |
run: | | |
# Alle Maven-Module (Anhand der POM-Dateien suchen) | |
ALL_MODULES=$(git ls-tree -d HEAD | awk '{print $4}' | jq -R -s -c 'split("\n") | map(select(length > 0))') | |
# Liste der Module filtern, die sich geändert haben | |
CHANGED_MODULES=$(git diff --name-only HEAD^ HEAD | awk -F'/' '{print $1}' | sort -u | jq -R -s -c 'split("\n") | map(select(length > 0))') | |
# Falls Änderungen vorhanden sind, speichere sie als Ausgabe | |
echo "Detected Changed Modules: $CHANGED_MODULES" | |
echo "changed_modules=$CHANGED_MODULES" >> $GITHUB_OUTPUT | |
build_and_test: | |
needs: detect-changes | |
if: ${{ needs.detect-changes.outputs.modules != '[]' }} | |
strategy: | |
matrix: | |
module: ${{ fromJson(needs.detect-changes.outputs.modules) }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' # See 'Supported distributions' for available options | |
java-version: '17' | |
cache: maven | |
- name: Build & Test ${{ matrix.module }} | |
run: mvn -B clean verify -pl ${{ matrix.module }} -am | |