.github/workflows/publish.yml #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
[ workflow_dispatch ] | |
jobs: | |
create_staging_repository: | |
runs-on: ubuntu-latest | |
name: Create staging repository | |
outputs: | |
repository-id: ${{ steps.create.outputs.repository_id }} | |
steps: | |
- id: create | |
uses: nexus-actions/create-nexus-staging-repo@main | |
with: | |
base_url: https://s01.oss.sonatype.org/service/local/ | |
description: ${{ github.repository }}/${{ github.workflow }}#${{ github.run_number }} | |
username: ${{ secrets.NEXUS_ACTIONS_SONATYPE_USERNAME }} | |
password: ${{ secrets.NEXUS_ACTIONS_SONATYPE_PASSWORD }} | |
staging_profile_id: ${{ secrets.NEXUS_ACTIONS_SONATYPE_PROFILE_ID }} | |
macos: | |
runs-on: macos-latest | |
needs: create_staging_repository | |
steps: | |
- name: Configure JDK | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Publish | |
run: | | |
./gradlew publishAllPublicationsToMavenRepository -PSONATYPE_REPOSITORY_ID=${{ needs.create_staging_repository.outputs.repository-id }} | |
env: | |
MANUAL_REPOSITORY: ${{ secrets.MANUAL_REPOSITORY }} | |
SONATYPE_REPOSITORY_ID: ${{ needs.create_staging_repository.outputs.repository-id }} | |
SONATYPE_USERNAME: ${{ secrets.NEXUS_ACTIONS_SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.NEXUS_ACTIONS_SONATYPE_PASSWORD }} | |
GPG_PRIVATE_KEY: ${{ secrets.NEXUS_ACTIONS_GPG_PRIVATE_KEY }} | |
GPG_PRIVATE_PASSWORD: ${{ secrets.NEXUS_ACTIONS_GPG_PRIVATE_PASSWORD }} | |
# Zipline does not support Windows yet! | |
# windows: | |
# runs-on: windows-latest | |
# needs: create_staging_repository | |
# steps: | |
# - name: Configure JDK | |
# uses: actions/setup-java@v1 | |
# with: | |
# java-version: 17 | |
# - name: Checkout | |
# uses: actions/checkout@v2 | |
# - name: Checkout zipline | |
# uses: actions/checkout@v2 | |
# with: | |
# repository: Shabinder/zipline | |
# path: zipline | |
# - name: Publish to Maven Local | |
# run: | | |
# cd zipline | |
# ./gradlew publishToMavenLocal | |
# cd .. | |
# - name: Publish | |
# run: | | |
# ./gradlew publishMingwX64PublicationToMavenRepository -PSONATYPE_REPOSITORY_ID=${{ needs.create_staging_repository.outputs.repository-id }} | |
# env: | |
# MANUAL_REPOSITORY: ${{ secrets.MANUAL_REPOSITORY }} | |
# SONATYPE_REPOSITORY_ID: ${{ needs.create_staging_repository.outputs.repository-id }} | |
# SONATYPE_USERNAME: ${{ secrets.NEXUS_ACTIONS_SONATYPE_USERNAME }} | |
# SONATYPE_PASSWORD: ${{ secrets.NEXUS_ACTIONS_SONATYPE_PASSWORD }} | |
# GPG_PRIVATE_KEY: ${{ secrets.NEXUS_ACTIONS_GPG_PRIVATE_KEY }} | |
# GPG_PRIVATE_PASSWORD: ${{ secrets.NEXUS_ACTIONS_GPG_PRIVATE_PASSWORD }} | |
finalize: | |
runs-on: ubuntu-latest | |
needs: [ create_staging_repository,macos ] #,windows ] | |
if: ${{ always() && needs.create_staging_repository.result == 'success' }} | |
steps: | |
- name: Discard | |
if: ${{ needs.macos.result != 'success' || needs.windows.result != 'success' }} | |
uses: nexus-actions/drop-nexus-staging-repo@main | |
with: | |
username: ${{ secrets.NEXUS_ACTIONS_SONATYPE_USERNAME }} | |
password: ${{ secrets.NEXUS_ACTIONS_SONATYPE_PASSWORD }} | |
staging_repository_id: ${{ needs.create_staging_repository.outputs.repository-id }} | |
- name: Release | |
if: ${{ needs.macos.result == 'success' && needs.windows.result == 'success' }} | |
uses: nexus-actions/release-nexus-staging-repo@main | |
with: | |
base_url: https://s01.oss.sonatype.org/service/local/ | |
username: ${{ secrets.NEXUS_ACTIONS_SONATYPE_USERNAME }} | |
password: ${{ secrets.NEXUS_ACTIONS_SONATYPE_PASSWORD }} | |
staging_repository_id: ${{ needs.create_staging_repository.outputs.repository-id }} |