-
-
Notifications
You must be signed in to change notification settings - Fork 12
170 lines (147 loc) · 6.89 KB
/
main.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: ci
on:
push:
branches:
- master
- develop
pull_request:
types: [ opened, synchronize, reopened ]
jobs:
build:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
java-version: [ 8 ]
python-version: [ 3.6 ]
env:
DOCKER_IMAGE: "aemdesign/centos-java-buildpack"
SONAR_ORGANISATION: "aemdesign-github"
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_URL: "https://sonarcloud.io"
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: "aemdesign"
GITHUB_USER: aemdesign
GITHUB_EMAIL: ${{ secrets.GITHUB_EMAIL }}
GITHUB_USERNAME: ${{ secrets.GITHUB_USERNAME }}
GITHUB_TOKEN_ADMIN: ${{ secrets.GITHUB_TOKEN_ADMIN }}
AEM_NAME: ${{ secrets.AEM_NAME }}
AEM_KEY: ${{ secrets.AEM_KEY }}
GPG_SECRET_KEYS: ${{ secrets.GPG_SECRET_KEYS }}
GPG_OWNERTRUST: ${{ secrets.GPG_OWNERTRUST }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_EXECUTABLE: gpg
GPG_PRESET_EXECUTABLE: /usr/lib/gnupg/gpg-preset-passphrase
GPG_PUBID: "50A036956AAC64C13EF47B10D1E96A30ECFC7DFF"
GPG_PUBID_KEYGRIP: "020E615868703482DC2CD110B98D2702B6ABF89C"
steps:
- uses: actions/checkout@v2
with:
submodules: true
lfs: true
- name: set up jdk ${{ matrix.java-version }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java-version }}
- name: set up python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: get release notes
id: config
run: |
source <(curl -sL https://github.com/aem-design/aemdesign-docker/releases/latest/download/github_get_version.sh)
- name: release notes
run: |
echo "${{ steps.config.outputs.GIT_RELEASE_NOTES }}"
echo CURRENT_VERSION="${{ steps.config.outputs.CURRENT_VERSION }}"
- name: set eval variables
run: |
echo "DOCKER_COMMAND=docker run --user $(id -u):$(id -g) -v ${GITHUB_WORKSPACE}:/build ${DOCKER_IMAGE}" >> $GITHUB_ENV
$DOCKER_COMMAND java -version
$DOCKER_COMMAND node -v
git config --global user.email "${GITHUB_EMAIL}"
git config --global user.name "${GITHUB_USERNAME}"
- name: setup gpg
run: |
source <(curl -sL https://github.com/aem-design/aemdesign-docker/releases/latest/download/setup-gpg.sh)
- name: cache sonarcloud packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: cache maven packages
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: mvn package
run: $DOCKER_COMMAND mvn package -B -Dmaven.repo.local=./build/.m2/repository
# SonarQube for master
#- name: docker - sonar qube on master
# if: github.ref == 'refs/heads/master'
# run: mvn sonar:sonar -q "-Dsonar.branch.name=${GITHUB_REF}" "-Dsonar.host.url=${SONAR_URL}" "-Dsonar.login=${SONAR_TOKEN}" "-Dsonar.organization=${SONAR_ORGANISATION}"
# SonarQube for branches
#- name: docker - sonar qube on branches
# if: github.ref != 'refs/heads/master'
# run: mvn sonar:sonar -q "-Dsonar.branch.name=${GITHUB_REF}" "-Dsonar.branch.target=master" "-Dsonar.host.url=${SONAR_URL}" "-Dsonar.login=${SONAR_TOKEN}" "-Dsonar.organization=${SONAR_ORGANISATION}"
- name: run unit tests with coverage reports
run: mvn test -q && bash <(curl -s https://codecov.io/bash)
- name: deploy to maven cental
if: github.ref == 'refs/heads/master'
run: $DOCKER_COMMAND echo $GPG_SECRET_KEYS | base64 --decode | $GPG_EXECUTABLE --import && echo $GPG_OWNERTRUST | base64 --decode | $GPG_EXECUTABLE --import-ownertrust && mvn deploy --settings default.xml -B -P release
- name: create release ${{ env.GITHUB_TAG }}
if: github.ref == 'refs/heads/master'
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.config.outputs.CURRENT_VERSION }}
release_name: ${{ steps.config.outputs.CURRENT_VERSION }}
body: ${{ steps.config.outputs.GIT_RELEASE_NOTES }}
draft: false
prerelease: false
- name: upload release asset - aemdesign-aem-core-deploy-${{ env.GITHUB_TAG }}.zip
if: github.ref == 'refs/heads/master'
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ format('./aemdesign-aem-{0}/target/aemdesign-aem-{0}-{1}.zip', 'core-deploy', env.GITHUB_TAG) }}
asset_name: ${{ format('aemdesign-aem-{0}-{1}.zip', 'core-deploy', env.GITHUB_TAG) }}
asset_content_type: application/zip
- name: upload release asset - aemdesign-aem-services-${{ env.GITHUB_TAG }}.zip
if: github.ref == 'refs/heads/master'
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ format('./aemdesign-aem-{0}/target/aemdesign-aem-{0}-{1}.jar', 'services', env.GITHUB_TAG) }}
asset_name: ${{ format('aemdesign-aem-{0}-{1}.jar', 'services', env.GITHUB_TAG) }}
asset_content_type: application/java-archive
- name: upload release asset - aemdesign-aem-author-${{ env.GITHUB_TAG }}.zip
if: github.ref == 'refs/heads/master'
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ format('./aemdesign-aem-{0}/target/aemdesign-aem-{0}-{1}.zip', 'author', env.GITHUB_TAG) }}
asset_name: ${{ format('aemdesign-aem-{0}-{1}.zip', 'author', env.GITHUB_TAG) }}
asset_content_type: application/zip
- name: upload release asset - aemdesign-aem-common-${{ env.GITHUB_TAG }}.zip
if: github.ref == 'refs/heads/master'
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ format('./aemdesign-aem-{0}/target/aemdesign-aem-{0}-{1}.zip', 'common', env.GITHUB_TAG) }}
asset_name: ${{ format('aemdesign-aem-{0}-{1}.zip', 'common', env.GITHUB_TAG) }}
asset_content_type: application/zip