-
Notifications
You must be signed in to change notification settings - Fork 8
148 lines (126 loc) · 4.73 KB
/
build.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
name: Surf
on:
push:
branches:
- develop
- "**/APPS-**"
- "support/**"
pull_request:
branches:
- develop
- "support/**"
workflow_dispatch:
inputs:
commitMessage:
description: Enter the Commit Message
required: true
env:
SRCCLR_API_TOKEN: ${{ secrets.SRCCLR_API_TOKEN }}
MAVEN_USERNAME: ${{ secrets.NEXUS_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}
QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
GIT_EMAIL: ${{ secrets.BOT_GITHUB_EMAIL }}
GIT_USERNAME: ${{ secrets.BOT_GITHUB_USERNAME }}
GIT_PASSWORD: ${{ secrets.BOT_GITHUB_TOKEN }}
BRANCH_NAME: ${{ github.ref_name }}
jobs:
Source_Clear_Scan:
if: ${{ startsWith(github.ref_name, 'support/') && github.event_name != 'pull_request' && !contains(github.event.head_commit.message, '[no_release]') && github.event.repository.fork==false && !contains(inputs.commitMessage, '[no_release]')}}
runs-on: ubuntu-latest
needs: Build_and_test
steps:
# Typical Java workflow steps
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "Set up Java"
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: 17
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: "Setup maven"
shell: bash
run: |
[ -d ${HOME}/.m2/ ] || mkdir -p ${HOME}/.m2/
cp -v surf/_ci/settings.xml ${HOME}/.m2/ || cp -v surf/_ci/.travis.settings.xml ${HOME}/.m2/settings.xml
- name: "Cache the Maven packages to speed up build"
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: "Starting Source Clear Script"
run: bash surf/_ci/source_clear.sh
Build_and_test:
runs-on: ubuntu-latest
steps:
# Typical Java workflow steps
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "Set up Java"
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: 17
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: "Cache the Maven packages to speed up build"
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: "Run script"
run: |
cd surf
cp _ci/.travis.settings.xml $HOME/.m2/settings.xml
mvn clean
mvn install -DskipTests=true -B -V
mvn test
Release:
if: ${{ startsWith(github.ref_name, 'support/') && github.event_name != 'pull_request' && !contains(github.event.head_commit.message, '[no_release]') && github.event.repository.fork==false && !contains(inputs.commitMessage, '[no_release]')}}
runs-on: ubuntu-latest
needs: Build_and_test
steps:
# Typical Java workflow steps
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "Set up Java"
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: 17
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: "Setup maven"
shell: bash
run: |
[ -d ${HOME}/.m2/ ] || mkdir -p ${HOME}/.m2/
cp -v surf/_ci/settings.xml ${HOME}/.m2/ || cp -v surf/_ci/.travis.settings.xml ${HOME}/.m2/settings.xml
- name: "Cache the Maven packages to speed up build"
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Get branch name
uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]
- name: "Use full history for release"
run: git checkout -B "$BRANCH_NAME"
- name: "Get the latest changes on branch"
run: git pull
- name: "Add email to link commits to user"
run: git config user.email "${GIT_EMAIL}"
- name: "Add user name to link commits to user"
run: git config user.name "${GIT_USERNAME}"
- name: "Skip building of release commits"
run: |
cd surf
mvn --batch-mode -q -DscmCommentPrefix="[maven-release-plugin][skip ci] " -Dusername="${GIT_USERNAME}" -Dpassword="${GIT_PASSWORD}" -DskipTests -Darguments=-DskipTests -Darguments=-Dmaven.javadoc.skip=true release:clean release:prepare release:perform