-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (45 loc) · 1.87 KB
/
workflow_run_publish_wf.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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}}"