42 lines
1.8 KiB
YAML
42 lines
1.8 KiB
YAML
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
|
|
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
|
|
|
|
name: Java CI with Maven Deploy
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
build:
|
|
name: Build and Deploy On Push
|
|
|
|
runs-on: ubuntu-latest
|
|
if: ${{ github.repository == 'spring-projects/spring-guice' }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Set up JDK 17
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
java-version: '17'
|
|
distribution: 'temurin'
|
|
cache: maven
|
|
- name: Deploy with Maven
|
|
env:
|
|
spring_username: ${{ secrets.ARTIFACTORY_USERNAME }}
|
|
spring_password: ${{ secrets.ARTIFACTORY_PASSWORD }}
|
|
sonatype_username: ${{ secrets.OSSRH_USERNAME }}
|
|
sonatype_password: ${{ secrets.OSSRH_PASSWORD }}
|
|
signing_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
|
passphrase: ${{ secrets.GPG_PASSPHRASE }}
|
|
run: |
|
|
echo "${signing_key}" > private.asc
|
|
gpg --import --batch --no-tty private.asc
|
|
token=`curl -H "Accept: application/json" -H "Content-Type: application/json" --data '{"u":"'$(echo -n $sonatype_username | base64)'","p":"'$(echo -n $sonatype_password | base64)'"}' -u $sonatype_username:$sonatype_password https://oss.sonatype.org/service/siesta/wonderland/authenticate | jq -r .t`
|
|
creds=`curl -H "Accept: application/json" -H "Content-Type: application/json" -H "X-NX-AuthTicket: $token" -u $sonatype_username:$sonatype_password https://oss.sonatype.org/service/siesta/usertoken/current`
|
|
export nexus_username=`echo $creds | jq -r .nameCode`
|
|
export nexus_password=`echo $creds | jq -r .passCode`
|
|
./mvnw -B deploy -s .mvn/settings.xml
|
|
|