forked from Activiti/Activiti
-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (81 loc) · 3.16 KB
/
main_pull.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
name: PR - Validate and Build
permissions: read-all
on:
pull_request:
branches:
- develop
types:
- opened
- reopened
- synchronize
- labeled
# Allows to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
jobs:
pre-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Check dependabot build
uses: ./.github/actions/check-ext-build
- name: pre-commit
uses: Alfresco/alfresco-build-tools/.github/actions/pre-commit@4e8b494acd09f732d9caec5df802af27f396a7e4 # v5.27.0
with:
skip_checkout: true
- name: Ensure SHA pinned actions
uses: zgosalvez/github-actions-ensure-sha-pinned-actions@40e45e738b3cad2729f599d8afc6ed02184e1dbd # v3.0.5
build:
runs-on: ubuntu-latest
needs: pre-checks
steps:
- name: Checkout repository
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Setup Java JDK 21
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # 4.2.1
with:
java-version: 21
distribution: 'temurin'
- name: Set preview version
if: ${{ contains(github.event.pull_request.labels.*.name, 'preview') }}
run: |
GITHUB_PR_NUMBER=PR-${{ github.event.pull_request.number }}
echo 0.0.1-${GITHUB_PR_NUMBER}-${GITHUB_RUN_NUMBER}-SNAPSHOT > VERSION
- name: Set VERSION env variable
if: ${{ contains(github.event.pull_request.labels.*.name, 'preview') }}
run: |
VERSION=$(cat VERSION)
echo set VERSION=$VERSION
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Update pom files to the new version
if: ${{ contains(github.head_ref, 'preview') || contains(github.event.pull_request.labels.*.name, 'preview') }}
run: mvn -B versions:set -DnewVersion=$VERSION -DprocessAllModules=true -DgenerateBackupPoms=false
- name: Define Maven Command
id: define_maven_command
shell: bash
run: |
if [ $DO_PUSH == 'true' ]
then
echo "command=deploy" >> $GITHUB_OUTPUT
else
echo "command=verify" >> $GITHUB_OUTPUT
fi
env:
DO_PUSH: ${{ contains(github.event.pull_request.labels.*.name, 'preview') }}
- name: Build and Test with Maven (and maybe Deploy)
shell: bash
run: mvn ${{ steps.define_maven_command.outputs.command }} ${{ env.MAVEN_CLI_OPTS}}
env:
MAVEN_CLI_OPTS: --show-version --no-transfer-progress --settings settings.xml
MAVEN_USERNAME: ${{ secrets.NEXUS_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
- name: Echo Longest Test Run
uses: ./.github/actions/echo-longest-run