Skip to content

Merge pull request #307 from com-pas/develop #9

Merge pull request #307 from com-pas/develop

Merge pull request #307 from com-pas/develop #9

# SPDX-FileCopyrightText: 2023 Alliander N.V.
#
# SPDX-License-Identifier: Apache-2.0
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
name: release-please
jobs:
release_please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: maven
package-name: compas-core
target-branch: main
- if: ${{ steps.release.outputs.release_created }}
name: Checkout
uses: actions/checkout@v4
- name: Extract tag name
if: ${{ steps.release.outputs.release_created }}
id: extract_tagname
shell: bash
# Extract the tag name from the git reference, value of GITHUB_REF will be something like refs/tags/<tag_name>.
run: echo "##[set-output name=tagname;]$(echo ${GITHUB_REF##*/})"
- name: Set up JDK 17
uses: actions/setup-java@v4
if: ${{ steps.release.outputs.release_created }}
with:
distribution: 'zulu'
java-version: '17'
- name: Create custom Maven Settings.xml
uses: whelk-io/maven-settings-xml-action@v21
if: ${{ steps.release.outputs.release_created }}
with:
output_file: custom_maven_settings.xml
servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]'
- name: Set version with Maven
if: ${{ steps.release.outputs.release_created }}
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
if: ${{ steps.release.outputs.release_created }}
run: ./mvnw -B -s custom_maven_settings.xml -Prelease clean deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}