-
Notifications
You must be signed in to change notification settings - Fork 4
154 lines (131 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
149
150
151
152
153
154
name: alfresco Extension Inspector Build Workflow
on:
push:
branches:
- master
- 'fix/**'
- 'support/**'
- 'feature/**'
pull_request:
branches:
- master
workflow_dispatch:
inputs:
commitMessage:
description: Enter the Commit Message
required: true
env:
SRCCLR_API_TOKEN: ${{ secrets.SRCCLR_API_TOKEN }}
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
GITHUB_EVENT: ${{ github.event_name }}
VERSION: 2.0.0
jobs:
pmd_scan:
name: "PMD Scan"
runs-on: ubuntu-latest
if: >
github.event_name == 'pull_request' &&
!contains(github.event.head_commit.message, '[skip pmd]') &&
!contains(github.event.head_commit.message, '[skip tests]') &&
!contains(github.event.head_commit.message, '[force]')
steps:
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: adopt
java-version: 17
- uses: Alfresco/[email protected]
with:
fail-on-new-issues: "false"
create-github-annotations: "false"
tests:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, '[skip tests]') || inputs.commitMessage == '[skip tests]' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: adopt
java-version: 17
- name: Setup maven
shell: bash
run: |
[ -d ${HOME}/.m2/ ] || mkdir -p ${HOME}/.m2/
cp -v _ci/settings.xml ${HOME}/.m2/ || cp -v .travis.settings.xml ${HOME}/.m2/settings.xml
- name: Cache the Maven packages to speed up build
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Run Source Code
run: bash _ci/source_clear.sh
continue-on-error: true
- name: Run Unit Test
run: bash _ci/unit_tests.sh
release:
name: "Release"
runs-on: ubuntu-latest
needs: tests
if: ${{ ( startsWith(github.ref_name, 'support/') || github.ref_name == 'master' ) &&
contains(github.event.head_commit.message, '[release]') || inputs.commitMessage == '[release]' }}
steps:
- uses: actions/setup-python@v5
with:
python-version: 3.8
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "Configure AWS credentials"
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_S3_STAGING_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_S3_STAGING_SECRET_KEY }}
aws-region: eu-west-1
- uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]
- name: Get branch name
uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]
- name: Setup maven
shell: bash
run: |
[ -d ${HOME}/.m2/ ] || mkdir -p ${HOME}/.m2/
cp -v _ci/settings.xml ${HOME}/.m2/ || cp -v .travis.settings.xml ${HOME}/.m2/settings.xml
- name: Cache the Maven packages to speed up build
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: "release to nexus"
env:
GIT_USERNAME: ${{ secrets.BOT_GITHUB_USERNAME }}
GIT_EMAIL: ${{ secrets.BOT_GITHUB_EMAIL }}
GIT_PASSWORD: ${{ secrets.BOT_GITHUB_TOKEN }}
BUILD_NUMBER: ${{ github.run_number }}
run: bash _ci/release.sh
- name: "prepare_staging_deploy"
run: bash _ci/prepare_staging_deploy.sh
- name: "Deploy to S3 Staging Bucket"
run : aws s3 cp --recursive ./deploy_dir s3://alfresco-artefacts-staging/AlfrescoExtensionInspector/${VERSION}
publish:
name: "Copy-to-S3-Release-Bucket"
runs-on: ubuntu-latest
needs: release
if: ${{ ( startsWith(github.ref_name, 'support/') || github.ref_name == 'master' ) &&
contains(github.event.head_commit.message, '[publish]') || inputs.commitMessage == '[publish]' &&
github.event_name != 'pull_request'}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_S3_RELEASE_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_S3_RELEASE_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
- name: "copy to release bucket"
run : bash _ci/copy_to_release_bucket.sh