Skip to content

Førebu bibliotek, del 1: Kutte koplingar til spesifikke malar frå brevbaker #251

Førebu bibliotek, del 1: Kutte koplingar til spesifikke malar frå brevbaker

Førebu bibliotek, del 1: Kutte koplingar til spesifikke malar frå brevbaker #251

name: "Build and release pensjon-brevbaker-api-model"
on:
pull_request:
branches:
- "main"
paths:
- "pensjon-brevbaker-api-model/**"
- "brevbaker-api-model-common/**"
- ".github/workflows/brevbaker-api-model.yaml"
push:
branches:
- "main"
paths:
- "pensjon-brevbaker-api-model/**"
- "brevbaker-api-model-common/**"
- ".github/workflows/brevbaker-api-model.yaml"
jobs:
changes:
runs-on: ubuntu-latest
outputs:
common: ${{ steps.changes.outputs.common }}
pensjonsbrev: ${{ steps.changes.outputs.pensjonsbrev }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
common:
- 'brevbaker-api-model-common/**'
pensjonsbrev:
- 'pensjon-brevbaker-api-model/**'
"release-common":
name: "brevbaker-api-model-common"
runs-on: "ubuntu-latest"
permissions:
packages: write
needs: [ changes ]
steps:
- uses: "actions/checkout@v4"
- uses: "gradle/actions/wrapper-validation@v3"
- uses: "actions/cache@v4"
with:
"path": "~/.gradle/caches"
"key": "${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}"
"restore-keys": "${{ runner.os }}-gradle-"
- uses: "actions/setup-java@v4"
with:
"distribution": "temurin"
"java-version": "17"
- name: "compile and run tests"
run: "./gradlew :brevbaker-api-model-common:build"
- name: "Release maven artifact"
if: ${{ github.ref == 'refs/heads/main' && needs.changes.outputs.common == 'true' }}
run: "./gradlew :brevbaker-api-model-common:publish"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
"release-pensjon":
name: "pensjon-brevbaker-api-model"
runs-on: "ubuntu-latest"
permissions:
packages: write
needs: [ release-common, changes ]
if: ${{ always() && (needs.release-common.result == 'success' || needs.release-common.result == 'skipped') }}
steps:
- uses: "actions/checkout@v4"
- uses: "gradle/actions/wrapper-validation@v3"
- uses: "actions/cache@v4"
with:
"path": "~/.gradle/caches"
"key": "${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}"
"restore-keys": "${{ runner.os }}-gradle-"
- uses: "actions/setup-java@v4"
with:
"distribution": "temurin"
"java-version": "17"
- name: "compile and run tests"
run: |
./gradlew :brevbaker-api-model-common:publishToMavenLocal
./gradlew :pensjon-brevbaker-api-model:build
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: "Release maven artifact"
if: ${{ github.ref == 'refs/heads/main' && needs.changes.outputs.pensjonsbrev == 'true' }}
run: "./gradlew :pensjon-brevbaker-api-model:publish"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"