| 1 |
# Licensed to the Apache Software Foundation (ASF) under one or more |
| 2 |
# contributor license agreements. See the NOTICE file distributed with |
| 3 |
# this work for additional information regarding copyright ownership. |
| 4 |
# The ASF licenses this file to You under the Apache License, Version 2.0 |
| 5 |
# (the "License"); you may not use this file except in compliance with |
| 6 |
# the License. You may obtain a copy of the License at |
| 7 |
# |
| 8 |
# https://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
# |
| 10 |
# Unless required by applicable law or agreed to in writing, software |
| 11 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
# See the License for the specific language governing permissions and |
| 14 |
# limitations under the License. |
| 15 |
# For most projects, this workflow file will not need changing; you simply need |
| 16 |
# to commit it to your repository. |
| 17 |
|
| 18 |
name: "Publish Snapshot to Maven" |
| 19 |
on: |
| 20 |
workflow_dispatch: |
| 21 |
push: |
| 22 |
branches: [ main ] |
| 23 |
paths: |
| 24 |
- .github/workflows/java-publish-snapshot.yml |
| 25 |
- lang/java/** |
| 26 |
- pom.xml |
| 27 |
|
| 28 |
concurrency: |
| 29 |
group: ${{ github.workflow }}-${{ github.ref }} |
| 30 |
cancel-in-progress: true |
| 31 |
|
| 32 |
jobs: |
| 33 |
publish-snapshot: |
| 34 |
runs-on: ubuntu-latest |
| 35 |
steps: |
| 36 |
- uses: actions/checkout@v5 |
| 37 |
|
| 38 |
- name: Cache Local Maven Repository |
| 39 |
uses: actions/cache@v4 |
| 40 |
with: |
| 41 |
path: ~/.m2/repository |
| 42 |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} |
| 43 |
restore-keys: | |
| 44 |
${{ runner.os }}-maven- |
| 45 |
|
| 46 |
- name: 'Setup Temurin JDK 8, 11, 17 & 21' |
| 47 |
uses: actions/setup-java@v5 |
| 48 |
with: |
| 49 |
distribution: 'temurin' |
| 50 |
java-version: | |
| 51 |
8 |
| 52 |
11 |
| 53 |
17 |
| 54 |
21 |
| 55 |
|
| 56 |
- name: 'Setup Maven' |
| 57 |
uses: stCarolas/setup-maven@d6af6abeda15e98926a57b5aa970a96bb37f97d1 # v5 |
| 58 |
with: |
| 59 |
maven-version: 3.9.8 |
| 60 |
|
| 61 |
- name: 'Deploy Maven snapshots' |
| 62 |
env: |
| 63 |
ASF_USERNAME: ${{ secrets.NEXUS_USER }} |
| 64 |
ASF_PASSWORD: ${{ secrets.NEXUS_PW }} |
| 65 |
run: | |
| 66 |
echo "<settings><servers><server><id>apache.snapshots.https</id><username>$ASF_USERNAME</username><password>$ASF_PASSWORD</password></server></servers></settings>" > ${{runner.temp}}/settings.xml |
| 67 |
mvn --settings ${{runner.temp}}/settings.xml -U -B -e -fae -ntp -PskipQuality deploy |