diff --git a/.github/workflows/maven.yaml b/.github/workflows/maven.yaml index 0bc7dc33d..eb13a7ce9 100644 --- a/.github/workflows/maven.yaml +++ b/.github/workflows/maven.yaml @@ -1,5 +1,4 @@ -name: Maven - +name: Maven on: workflow_call: inputs: @@ -8,20 +7,37 @@ on: required: true default: 'package' type: string - + permissions: contents: read packages: write jobs: - build: - name: build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: whelk-io/maven-settings-xml-action@v22 - with: + build: + name: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + + - name: Cache Maven packages + uses: actions/cache@v3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + + - uses: whelk-io/maven-settings-xml-action@v22 + with: servers: '[{ "id":"dvsa-github-packages", "configuration": { "httpHeaders": { "property": { "name":"Authorization", "value":"Bearer ${{ secrets.GITHUB_TOKEN }}"} } } },{ "id":"github-publish", "configuration": { "httpHeaders": { "property": { "name":"Authorization", "value":"Bearer ${{ secrets.GITHUB_TOKEN }}"} } } } ]' - - - run: mvn -B -P github ${{ inputs.maven-goal}} - \ No newline at end of file + + - name: Build with Maven + run: mvn -B -P github ${{ inputs.maven-goal}} -Dmaven.repo.local=$HOME/.m2/repository \ No newline at end of file