Skip to content

github: temporarily run worklow on any push #8

github: temporarily run worklow on any push

github: temporarily run worklow on any push #8

name: Maven build and deploy JVM
on:
push:
# XXX temporarily run on every push
# tags:
# - '*'
workflow_dispatch:
inputs:
package_version:
description: 'Custom version to use for maven package. Defaults to `git describe`.'
required: false
jobs:
build:
name: Build JVM package and deploy to Maven repo
# Based on: UbiqueInnovation/workflows-backend/.github/workflows/mvn_package_deploy.yml@feature/alt-deployment-repository
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2-
- name: Install build dependency apt packages
run: |
sudo apt install cmake make clang libgl-dev libgles-dev libosmesa6-dev
- name: Create custom artifactory settings.xml
uses: whelk-io/maven-settings-xml-action@9dc09b23833fa9aa7f27b63db287951856f3433d
with:
servers: '[{"id": "ubique-artifactory", "username": "${{ secrets.UB_ARTIFACTORY_USER}}", "password": "${{ secrets.UB_ARTIFACTORY_PASSWORD }}"}]'
repositories: '[{"id" : "ubique-artifactory", "url" : "${{ secrets.UB_ARTIFACTORY_URL }}${{ secrets.UB_ARTIFACTORY_REPO_BACKEND }}"}]'
- name: Set custom VERSION from workflow dispatch input
if: ${{ inputs.package_version }}
run: echo "VERSION=${{ inputs.package_version }}" >> $GITHUB_ENV
- name: Set VERSION with git describe
if: ${{ ! inputs.package_version }}
run: echo "VERSION=$(git describe --tags --always)" >> $GITHUB_ENV
- name: Set version
run: |
set -x
# Strip leading `v` from VERSION
# Replace all characters in `\/:"<>|?*` by `-` in VERSION
VERSION=$(echo "$VERSION" | sed 's/[\/:"<>|?*]/-/g;s/^v//;')
mvn -f jvm/pom.xml versions:set -DnewVersion=$VERSION
mvn -f jvm/pom.xml versions:commit
- name: Build and deploy package
run: mvn -f jvm/pom.xml deploy -DskipTests -DaltDeploymentRepository="ubique-artifactory::${{ secrets.UB_ARTIFACTORY_URL }}${{ secrets.UB_ARTIFACTORY_REPO_BACKEND }}"