-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (44 loc) · 1.56 KB
/
forked_build_workflow.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
name: Forked Build Pipeline
run-name: 'Forked Build Pipeline For ${{github.head_ref}}'
on:
pull_request:
env:
FORKED_REPO: ${{github.actor}}/Noob-GitHub-Actions-POC
HEAD_REF_BRANCH: ${{github.head_ref}}
IS_SNAPSHOT_VERSION: "false"
TRUNK_BRANCH: 'main'
jobs:
build-job:
name: Build Job
runs-on: ubuntu-latest
outputs:
pomVersion: ${{steps.get_current_version.outputs.POM_VERSION}}
isSnapshot: ${{env.IS_SNAPSHOT_VERSION}}
branchName: ${{env.HEAD_REF_BRANCH}}
repoName: ${{env.FORKED_REPO}}
steps:
- name: Checkout Code Repository
uses: actions/checkout@v4
- name: Downloading Java
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'adopt'
- name: Maven Build
if: github.ref == 'refs/heads/main'
run: |
echo 'Running in main branch'
mvn clean install
- name: Maven Build -- Feature Branch
if: github.ref != 'refs/heads/main'
run: |
echo 'Running in ${{github.ref_name}} branch'
mvn clean install
- name: Get Current Version
id: get_current_version
run: |
echo "POM_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT
- name: Is Snapshot Version
id: get_snapshot_version
if: contains(${{env.POM_VERSION}}, '-SNAPSHOT')
run: echo "IS_SNAPSHOT_VERSION=true" >> $GITHUB_ENV