Skip to content

bld_mvn

bld_mvn #7

Workflow file for this run

name: bld_mvn
permissions:
checks: write
contents: read
issues: read
pull-requests: write
on:
workflow_call:
inputs:
project:
description: 'Name of the artifact env'
required: false
default: 'prod'
type: string
version_tag:
description: 'Name of the tag to build'
required: false
default: 'latest'
type: string
bump:
description: 'whether to bump the version number by a major minor patch amount or none'
required: false
default: 'patch'
type: string
ref:
description: 'git reference to use with the checkout use default_branch to have that calculated'
required: false
default: "default"
type: string
seed_maven_cache:
description: Whether to seed cache
type: boolean
required: false
default: true
install_maven_dependencies:
description: Whether to install dependencies or use a previous cache
type: boolean
required: false
default: true
workflow_dispatch:
inputs:
project:
description: 'Name of the artifact env'
required: false
default: 'prod'
type: string
version_tag:
description: 'Version tag to use: (bump must also be set to none to keep a specific version'
required: false
default: 'latest'
type: string
bump:
description: |
How to optionally bump the semver version ( Major.Minor.Patch ) : git log will be searched for
'#major #minor #patch' or feat/ or fix/ branch names to optionally override the bump. Set to none to keep a specific version
required: false
options:
- patch
- minor
- major
- none
type: choice
ref:
description: 'git reference to use with the checkout use default_branch to have that calculated'
required: false
default: "default"
type: string
seed_maven_cache:
description: Whether to seed cache
type: boolean
required: false
default: true
install_maven_dependencies:
description: Whether to install dependencies or use a previous cache
type: boolean
required: false
default: true
jobs:
bld_mvn:
strategy:
matrix:
include:
- project: hello-world
- project: hello-world-alt
runs-on: ubuntu-latest
steps:
- name: git-checkout-ref-action
id: ref
uses: ORCID/git-checkout-ref-action@main
with:
default_branch: ${{ github.event.repository.default_branch }}
ref: ${{ inputs.ref }}
- uses: actions/checkout@v4
with:
ref: ${{ steps.ref.outputs.ref }}
# checkout some history so we can scan commits for bump messages
# NOTE: history does not include tags!
fetch-depth: 100
- name: find next version
id: version
uses: ORCID/version-bump-action@main
with:
version_tag: ${{ inputs.version_tag }}
bump: ${{ inputs.bump }}
- name: Set up Open JDK 11
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- name: build our project
run: |
mvn -T 1C --batch-mode -am package -DskipTests \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
--projects "$project"
echo "------------------------------------------------------"
find . -name '*.war'
find . -name '*.jar'
env:
project: "${{ matrix.project }}"
##################################################################################################################
- name: deploy war file
run: |
mvn --batch-mode \
--settings settings-deploy.xml \
--file "${project}/pom.xml" \
-Dmaven.test.skip \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-DaltReleaseDeploymentRepository="github::${ARTIFACT_URL}${ARTIFACT_REPO_PATH}" \
deploy -Dmaven.test.skip
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
ARTIFACT_URL: "${{ secrets.ARTIFACT_URL }}"
ARTIFACT_REPO_PATH: "${{ secrets.ARTIFACT_REPO_PATH }}"
ARTIFACT_USER: "${{ secrets.ARTIFACT_USER }}"
ARTIFACT_PASSWORD: "${{ secrets.ARTIFACT_PASSWORD }}"
project: "${{ matrix.project }}"