|
1 |
| -# SPDX-FileCopyrightText: 2022 Alliander N.V. |
| 1 | +# SPDX-FileCopyrightText: 2023 Alliander N.V. |
2 | 2 | #
|
3 | 3 | # SPDX-License-Identifier: Apache-2.0
|
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
4 | 8 |
|
5 |
| -name: Release Project |
| 9 | +permissions: |
| 10 | + contents: write |
| 11 | + pull-requests: write |
6 | 12 |
|
7 |
| -on: |
8 |
| - release: |
9 |
| - types: [ released ] |
| 13 | +name: release-please |
10 | 14 |
|
11 | 15 | jobs:
|
12 |
| - release_project: |
13 |
| - name: Release project |
| 16 | + release_please: |
14 | 17 | runs-on: ubuntu-latest
|
15 |
| - timeout-minutes: 30 |
16 |
| - |
17 | 18 | steps:
|
| 19 | + - uses: google-github-actions/release-please-action@v4 |
| 20 | + id: release |
| 21 | + with: |
| 22 | + release-type: maven |
| 23 | + package-name: compas-scl-data-service |
18 | 24 | - name: Checkout
|
| 25 | + if: ${{ steps.release.outputs.release_created }} |
19 | 26 | uses: actions/checkout@v4
|
20 | 27 |
|
21 | 28 | - name: Cache Docker Register
|
22 |
| - uses: actions/cache@v3 |
| 29 | + if: ${{ steps.release.outputs.release_created }} |
| 30 | + uses: actions/cache@v4 |
23 | 31 | with:
|
24 | 32 | path: /tmp/.buildx-cache
|
25 | 33 | key: ${{ runner.os }}-buildx-${{ hashFiles('**/Dockerfile') }}
|
26 | 34 |
|
27 | 35 | - name: Extract tag name
|
| 36 | + if: ${{ steps.release.outputs.release_created }} |
28 | 37 | id: extract_tagname
|
29 | 38 | shell: bash
|
30 | 39 | # Extract the tag name from the git reference, value of GITHUB_REF will be something like refs/tags/<tag_name>.
|
31 | 40 | run: echo "##[set-output name=tagname;]$(echo ${GITHUB_REF##*/})"
|
32 | 41 |
|
33 | 42 | - name: Set up JDK 17
|
34 |
| - uses: actions/setup-java@v3 |
| 43 | + if: ${{ steps.release.outputs.release_created }} |
| 44 | + uses: actions/setup-java@v4 |
35 | 45 | with:
|
36 | 46 | distribution: 'zulu'
|
37 | 47 | java-version: '17'
|
38 | 48 | cache: 'maven'
|
39 | 49 | - name: Set up Docker Buildx
|
| 50 | + if: ${{ steps.release.outputs.release_created }} |
40 | 51 | id: buildx
|
41 | 52 | uses: docker/setup-buildx-action@v3
|
42 | 53 | - name: Login to Docker Hub
|
| 54 | + if: ${{ steps.release.outputs.release_created }} |
43 | 55 | uses: docker/login-action@v3
|
44 | 56 | with:
|
45 | 57 | username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
46 | 58 | password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
47 | 59 |
|
48 | 60 | - name: Create custom Maven Settings.xml
|
49 |
| - uses: whelk-io/maven-settings-xml-action@v21 |
| 61 | + if: ${{ steps.release.outputs.release_created }} |
| 62 | + uses: whelk-io/maven-settings-xml-action@v22 |
50 | 63 | with:
|
51 | 64 | output_file: custom_maven_settings.xml
|
52 | 65 | servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]'
|
53 | 66 | - name: Set version with Maven
|
| 67 | + if: ${{ steps.release.outputs.release_created }} |
54 | 68 | run: ./mvnw -B versions:set -DprocessAllModules=true -DnewVersion=${{ steps.extract_tagname.outputs.tagname }}
|
55 | 69 | env:
|
56 | 70 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
57 | 71 | - name: Deploy with Maven to GitHub Packages and Docker Hub
|
| 72 | + if: ${{ steps.release.outputs.release_created }} |
58 | 73 | run: ./mvnw -B -s custom_maven_settings.xml -Pjvm-image,release clean deploy
|
59 | 74 | env:
|
60 | 75 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
0 commit comments