name: Build, test and publish the Quarkus libraries on: [ push, workflow_dispatch ] jobs: build: runs-on: ubuntu-latest steps: - name: Checkout the code uses: https://github.com/actions/checkout@v4 - name: Set up JDK 21 uses: https://github.com/actions/setup-java@v4 with: distribution: 'temurin' java-version: '21' - name: Configure Maven CI/CD settings uses: https://github.com/s4u/maven-settings-action@v3.1.0 with: servers: | [{ "id": "kvant", "configuration": { "httpHeaders": { "property": { "name": "Authorization", "value": "token ${{ secrets.PHOENIX_PACKAGE_WRITER_TOKEN }}" } } } }] - name: Generate Maven Repository cache keys id: cache-key run: | CURRENT_BRANCH="${{ gitea.base_ref || gitea.ref_name }}" CURRENT_MONTH=$(/bin/date -u "+%Y-%m") CURRENT_DAY=$(/bin/date -u "+%d") ROOT_CACHE_KEY="m2-cache" echo "m2-monthly-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}" >> $GITEA_OUTPUT echo "m2-monthly-branch-cache-key=${ROOT_CACHE_KEY}-${CURRENT_MONTH}-${CURRENT_BRANCH}" >> $GITEA_OUTPUT - name: Cache Maven Repository id: cache-maven uses: https://github.com/actions/cache@v4 with: path: ~/.m2/repository # A new cache will be stored daily. After that first store of the day, cache save actions will fail because the cache is immutable but it's not a problem. # The whole cache is dropped monthly to prevent unlimited growth. # The cache is per branch but in case we don't find a branch for a given branch, we will get a cache from another branch. key: ${{ steps.cache-key.outputs.m2-cache-key }} restore-keys: | ${{ steps.cache-key.outputs.m2-monthly-branch-cache-key }}- ${{ steps.cache-key.outputs.m2-monthly-cache-key }}- - name: Restore Maven Repository uses: https://github.com/actions/cache/restore@v4 with: path: ~/.m2/repository key: ${{ steps.cache-key.outputs.m2-cache-key }} restore-keys: | ${{ steps.cache-key.outputs.m2-monthly-branch-cache-key }}- ${{ steps.cache-key.outputs.m2-monthly-cache-key }}- - name: Make maven wrapper executable run: chmod +x mvnw - name: Populate the cache run: | ./mvnw quarkus:go-offline - name: Build and run tests run: ./mvnw verify - name: Upload libs to Forgejo Maven Registry if: gitea.ref == 'refs/heads/main' run: ./mvnw deploy -Dmaven.test.skip=true -Dmaven.javadoc.skip=true