-
Notifications
You must be signed in to change notification settings - Fork 17
151 lines (137 loc) · 4.68 KB
/
bld_mvn.yml
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: bld_mvn
permissions:
checks: write
contents: read
issues: read
pull-requests: write
on:
workflow_call:
inputs:
artifact_name:
description: 'Name of the artifact env'
required: false
default: 'prod'
type: string
version_tag:
description: 'Name of the tag to build'
required: false
default: 'latest'
type: string
bump:
description: 'whether to bump the version number by a major minor patch amount or none'
required: false
default: 'patch'
type: string
ref:
description: 'git reference to use with the checkout use default_branch to have that calculated'
required: false
default: "default"
type: string
workflow_dispatch:
inputs:
artifact_name:
description: 'Name of the artifact env'
required: false
default: 'prod'
type: string
version_tag:
description: 'Version tag to use: (bump must also be set to none to keep a specific version'
required: false
default: 'latest'
type: string
bump:
description: |
How to optionally bump the semver version ( Major.Minor.Patch ) : git log will be searched for
'#major #minor #patch' or feat/ or fix/ branch names to optionally override the bump. Set to none to keep a specific version
required: false
options:
- patch
- minor
- major
- none
type: choice
ref:
description: 'git reference to use with the checkout use default_branch to have that calculated'
required: false
default: "default"
type: string
jobs:
bld_mvn:
strategy:
matrix:
include:
- artifact_name: prod
- artifact_name: sandbox
- artifact_name: qa
- artifact_name: int
runs-on: ubuntu-latest
steps:
- name: git-checkout-ref-action
id: ref
uses: ORCID/git-checkout-ref-action@main
with:
default_branch: ${{ github.event.repository.default_branch }}
ref: ${{ inputs.ref }}
- uses: actions/checkout@v4
with:
ref: ${{ steps.ref.outputs.ref }}
# checkout some history so we can scan commits for bump messages
# NOTE: history does not include tags!
fetch-depth: 100
- name: find next version
id: version
uses: ORCID/version-bump-action@main
with:
version_tag: ${{ inputs.version_tag }}
bump: ${{ inputs.bump }}
- name: Set up Open JDK 11
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
cache: 'maven'
- name: show path
run: |
echo "$PATH"
which java
echo "$JAVA_HOME"
echo "$tag_numeric"
echo "$project"
ls -la
shell: bash
env:
version_tag_numeric: '${{ steps.version.outputs.version_tag_numeric }}'
project: '${{ matrix.artifact_name }}'
- name: bump version using prod profile
run: |
mvn -T 1C --batch-mode versions:set \
-DnewVersion="$version_tag_numeric" -DgenerateBackupPoms=false --activate-profiles prod -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
env:
version_tag_numeric: '${{ steps.version.outputs.version_tag_numeric }}'
- name: check some build related things
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
git --version
git status
git diff
git rev-parse --abbrev-ref HEAD
- name: build our project and deploy
run: |
mvn -T 1C --batch-mode \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
--settings settings-deploy.xml \
--file "pom.xml" \
-DaltReleaseDeploymentRepository="github::${ARTIFACT_URL}${ARTIFACT_REPO_PATH}" \
--activate-profiles "${build_env}" -Dnodejs.workingDirectory=. \
deploy -Dmaven.test.skip
echo "------------------------------------------------------"
find . -name '*.war'
find . -name '*.jar'
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
ARTIFACT_URL: '${{ secrets.ARTIFACT_URL }}'
ARTIFACT_REPO_PATH: '${{ secrets.ARTIFACT_REPO_PATH }}'
ARTIFACT_USER: '${{ secrets.ARTIFACT_USER }}'
ARTIFACT_PASSWORD: '${{ secrets.ARTIFACT_PASSWORD }}'
build_env: '${{ matrix.artifact_name }}'