Publish Artifacts #4
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
name: Publish Pipeline -- Workflow Run Version | |
run-name: 'Publish Artifacts' | |
on: | |
workflow_run: | |
workflows: | |
- Build Pipeline | |
- Forked Build Pipeline | |
- Release Workflow | |
types: | |
- completed | |
jobs: | |
publish-artifacts: | |
name: Publish Artifacts | |
runs-on: ubuntu-latest | |
if: github.event.workflow_run.conclusion == 'success' | |
env: | |
ARTIFACT_REPOSITORY_ID: "maven-releases" | |
REPOSITORY_NAME: ${{github.repository}} | |
BRANCH: "main" | |
steps: | |
- name: If Not Release Workflow Then Update Env | |
if: github.event.workflow.name != 'Release Workflow' | |
run: | | |
echo "REPOSITORY_NAME=${{github.actor}}/${{github.event.repository.name}}" >> $GITHUB_ENV | |
echo "BRANCH=${{github.event.workflow_run.head_branch}}" >> $GITHUB_ENV | |
echo "ARTIFACT_REPOSITORY_ID=maven-snapshots" >> $GITHUB_ENV | |
- name: Checkout Forked Code Repository | |
uses: actions/checkout@v4 | |
if: github.event.workflow.name == 'Forked Build Pipeline' | |
with: | |
repository: ${{env.REPOSITORY_NAME}} | |
ref: ${{env.BRANCH}} | |
- name: Checkout Code Repository | |
if: github.event.workflow.name == 'Build Pipeline' || github.event.workflow.name == 'Release Workflow' | |
uses: actions/checkout@v4 | |
- name: Downloading Java | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'adopt' | |
- name: Publish To Nexus Repository Manager | |
run: echo "Publishing to Nexus Repo -- ${{env.ARTIFACT_REPOSITORY_ID}}" | |
- name: Publish To OSSRH (Maven Central Staging) | |
if: env.ARTIFACT_REPOSITORY_ID == 'maven-releases' | |
run: echo "Publishint to OSSRH Repo -- ${{env.ARTIFACT_REPOSITORY_ID}}" | |