blob: be3b612dddcba9fb54f8a1e8f4c59bdaed14499a [file] [log] [blame]
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to you under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: deploy-snapshot-reusable
on:
workflow_call:
inputs:
java-version:
description: The Java compiler version
default: 17
type: string
secrets:
NEXUS_USERNAME:
description: Nexus snapshot repository username for deploying artifacts
required: true
NEXUS_PASSWORD:
description: Nexus snapshot repository password for deploying artifacts
required: true
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
- name: Set up Java
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # 3.7.0
with:
distribution: zulu
java-version: ${{ inputs.java-version }}
cache: maven
server-id: apache.snapshots.https
server-username: NEXUS_USERNAME
server-password: NEXUS_PASSWORD
- name: Export version
shell: bash
run: |
export PROJECT_VERSION=$(./mvnw \
--quiet --batch-mode -DforceStdout=true \
-Dexpression=project.version \
help:evaluate \
| tail -n 1)
echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV
- name: Upload to Nexus
shell: bash
env:
# `NEXUS_USERNAME` and `NEXUS_PASSWORD` are used in `~/.m2/settings.xml` created by `setup-java` action
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
run: |
./mvnw \
--show-version --batch-mode --errors --no-transfer-progress \
-P deploy