Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/ci.yml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# name: CI - Build and Test

# on:
# push:
# branches:
# - develop
# - feature/**
# - main
# pull_request:
# branches:
# - develop
# - main

# jobs:
# build:
# name: Build and Test
# runs-on: ubuntu-latest

# steps:
# - name: Checkout code
# uses: actions/checkout@v4

# - name: Set up JDK 21
# uses: actions/setup-java@v4
# with:
# java-version: '21'
# distribution: 'temurin'
# cache: 'maven'

# - name: Build with Maven
# run: mvn --batch-mode --update-snapshots clean install

# - name: Run tests
# run: mvn --batch-mode test

# - name: Run OWASP Dependency Check
# run: mvn --batch-mode org.owasp:dependency-check-maven:check
# continue-on-error: true

# - name: Upload test results
# if: always()
# uses: actions/upload-artifact@v4
# with:
# name: test-results
# path: '**/target/surefire-reports/*.xml'

# - name: Upload OWASP report
# if: always()
# uses: actions/upload-artifact@v4
# with:
# name: owasp-report
# path: '**/target/dependency-check-report.html'

# - name: Build Summary
# if: always()
# run: |
# echo "## 🔨 Build Summary" >> $GITHUB_STEP_SUMMARY
# echo "" >> $GITHUB_STEP_SUMMARY
# echo "**Branch:** ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY
# echo "**Commit:** ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
# echo "" >> $GITHUB_STEP_SUMMARY

# # Count test results
# TOTAL_TESTS=$(find . -name 'TEST-*.xml' -exec grep -h 'tests=' {} \; | sed 's/.*tests="\([0-9]*\)".*/\1/' | awk '{s+=$1} END {print s}')
# FAILED_TESTS=$(find . -name 'TEST-*.xml' -exec grep -h 'failures=' {} \; | sed 's/.*failures="\([0-9]*\)".*/\1/' | awk '{s+=$1} END {print s}')

# echo "**Tests:** ${TOTAL_TESTS:-0} total, ${FAILED_TESTS:-0} failed" >> $GITHUB_STEP_SUMMARY
12 changes: 6 additions & 6 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt'
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn test --file pom.xml
run: mvn --batch-mode test --file pom.xml -Ddependency-check.skip=true
83 changes: 83 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Publish to GitHub Packages

on:
push:
tags:
- 'v*.*.*' # Trigger on version tags like v2.0.0, v2.0.1, etc.
workflow_dispatch: # Allow manual trigger from GitHub UI

jobs:
publish:
name: Publish Maven Packages
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'
settings-path: ${{ github.workspace }}

- name: Configure Maven settings
run: |
mkdir -p ~/.m2
cp .github/workflows/settings.xml ~/.m2/settings.xml

- name: Extract version from tag
id: get_version
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "Publishing version: ${VERSION}"
else
echo "No tag found, using version from pom.xml"
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
fi

- name: Update version in pom.xml
if: startsWith(github.ref, 'refs/tags/')
run: |
mvn versions:set -DnewVersion=${{ steps.get_version.outputs.VERSION }} -DgenerateBackupPoms=false

- name: Build with Maven
run: mvn --batch-mode --update-snapshots clean install

- name: Run tests
run: mvn --batch-mode test

- name: Publish to GitHub Packages
run: mvn --batch-mode deploy -DskipTests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create Release Summary
run: |
echo "## 🚀 Published to GitHub Packages" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Version:** ${{ steps.get_version.outputs.VERSION }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Published Artifacts:" >> $GITHUB_STEP_SUMMARY
echo "- joko-security-core" >> $GITHUB_STEP_SUMMARY
echo "- joko-security-storage-postgres" >> $GITHUB_STEP_SUMMARY
echo "- joko-security-web" >> $GITHUB_STEP_SUMMARY
echo "- joko-security-autoconfigure" >> $GITHUB_STEP_SUMMARY
echo "- joko-security-starter" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### 📦 Usage:" >> $GITHUB_STEP_SUMMARY
echo '```xml' >> $GITHUB_STEP_SUMMARY
echo '<dependency>' >> $GITHUB_STEP_SUMMARY
echo ' <groupId>io.github.jokoframework</groupId>' >> $GITHUB_STEP_SUMMARY
echo ' <artifactId>joko-security-starter</artifactId>' >> $GITHUB_STEP_SUMMARY
echo " <version>${{ steps.get_version.outputs.VERSION }}</version>" >> $GITHUB_STEP_SUMMARY
echo '</dependency>' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
44 changes: 44 additions & 0 deletions .github/workflows/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">

<!--
Maven settings for GitHub Actions

This file is used by GitHub Actions workflows to authenticate with GitHub Packages.
The GITHUB_TOKEN is automatically provided by GitHub Actions.
-->

<servers>
<server>
<id>github</id>
<username>${env.GITHUB_ACTOR}</username>
<password>${env.GITHUB_TOKEN}</password>
</server>
</servers>

<profiles>
<profile>
<id>github</id>
<repositories>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/jokoframework/security</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
</profile>
</profiles>

<activeProfiles>
<activeProfile>github</activeProfile>
</activeProfiles>

</settings>
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ conf/*
db/*.db
*.db
/src/main/resources/application.properties
.DS_Store
.envrc

Binary file added .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
3 changes: 3 additions & 0 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
wrapperVersion=3.3.2
distributionType=bin
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
Loading
Loading