From ac76debe01838c7444c37a22ef07a58c342237ff Mon Sep 17 00:00:00 2001 From: Pascal Wilbrink Date: Fri, 1 Dec 2023 11:18:25 +0100 Subject: [PATCH] Create release-project.yml Signed-off-by: Pascal Wilbrink --- .github/workflows/release-project.yml | 45 +++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/release-project.yml diff --git a/.github/workflows/release-project.yml b/.github/workflows/release-project.yml new file mode 100644 index 0000000..5bb3ae0 --- /dev/null +++ b/.github/workflows/release-project.yml @@ -0,0 +1,45 @@ +# SPDX-FileCopyrightText: 2022 Alliander N.V. +# +# SPDX-License-Identifier: Apache-2.0 + +name: Release Project + +on: + release: + types: [ released ] + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Extract tag name + id: extract_tagname + shell: bash + # Extract the tag name from the git reference, value of GITHUB_REF will be something like refs/tags/. + run: echo "##[set-output name=tagname;]$(echo ${GITHUB_REF##*/})" + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: '17' + + - name: Create custom Maven Settings.xml + uses: whelk-io/maven-settings-xml-action@v21 + with: + output_file: custom_maven_settings.xml + servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]' + - name: Set version with Maven + run: ./mvnw -B versions:set -DprocessAllModules=true -DnewVersion=${{ steps.extract_tagname.outputs.tagname }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Deploy with Maven to GitHub Packages + run: ./mvnw -B -s custom_maven_settings.xml -Prelease clean deploy + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}