Skip to content

Commit 612b972

Browse files
committed
migrate to github actions pipeline
1 parent 59fc2cb commit 612b972

File tree

1 file changed

+113
-0
lines changed

1 file changed

+113
-0
lines changed

.github/workflows/main.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: ci
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
max-parallel: 4
10+
matrix:
11+
python-version: [3.6]
12+
env:
13+
DOCKER_IMAGE: "aemdesign/centos-java-buildpack"
14+
SONAR_ORGANISATION: "aemdesign-github"
15+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
16+
SONAR_URL: "https://sonarcloud.io"
17+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
18+
SONATYPE_USERNAME: "aemdesign"
19+
GITHUB_USER: aemdesign
20+
TRAVIS_TOKEN: ${{ secrets.TRAVIS_TOKEN }}
21+
GITHUB_EMAIL: ${{ secrets.GITHUB_EMAIL }}
22+
GITHUB_USERNAME: ${{ secrets.GITHUB_USERNAME }}
23+
GITHUB_TOKEN_ADMIN: ${{ secrets.GITHUB_TOKEN_ADMIN }}
24+
AEM_NAME: ${{ secrets.AEM_NAME }}
25+
AEM_KEY: ${{ secrets.AEM_KEY }}
26+
GPG_SECRET_KEYS: ${{ secrets.GPG_SECRET_KEYS }}
27+
GPG_OWNERTRUST: ${{ secrets.GPG_OWNERTRUST }}
28+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
29+
GPG_EXECUTABLE: gpg
30+
GPG_PRESET_EXECUTABLE: /usr/lib/gnupg/gpg-preset-passphrase
31+
GPG_PUBID: "50A036956AAC64C13EF47B10D1E96A30ECFC7DFF"
32+
GPG_PUBID_KEYGRIP: "020E615868703482DC2CD110B98D2702B6ABF89C"
33+
34+
35+
36+
steps:
37+
- uses: actions/checkout@v1
38+
with:
39+
submodules: true
40+
lfs: true
41+
- uses: actions/setup-node@v1
42+
with:
43+
node-version: '10.x'
44+
registry-url: https://npm.pkg.github.com/
45+
scope: "@aem-design"
46+
env:
47+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN_ADMIN }}
48+
- name: set up python ${{ matrix.python-version }}
49+
uses: actions/setup-python@v1
50+
with:
51+
python-version: ${{ matrix.python-version }}
52+
- name: get release notes
53+
run: |
54+
source <(curl -sL https://github.com/aem-design/aemdesign-docker/releases/latest/download/github_get_version.sh)
55+
echo "===START==="
56+
echo $GIT_RELEASE_NOTES
57+
echo "====END===="
58+
echo CURRENT_VERSION=$CURRENT_VERSION
59+
- name: set eval variables
60+
run: |
61+
echo ::set-env name=DOCKER_COMMAND::docker run --user $(id -u):$(id -g) -v ${GITHUB_WORKSPACE}:/build ${DOCKER_IMAGE}
62+
$DOCKER_COMMAND java -version
63+
$DOCKER_COMMAND node -v
64+
git config --global user.email "${GITHUB_EMAIL}"
65+
git config --global user.name "${GITHUB_USERNAME}"
66+
- name: setup gpg
67+
run: |
68+
source <(curl -sL https://github.com/aem-design/aemdesign-docker/releases/latest/download/setup-gpg.sh)
69+
- name: docker - mvn clean (cache .m2 in ./build/.m2/repository in repo dir)
70+
run: $DOCKER_COMMAND mvn clean -DskipTests=true -Dgpg.skip -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -B -Dmaven.repo.local=./build/.m2/repository
71+
- name: docker - mvn package
72+
run: $DOCKER_COMMAND mvn package -DskipTests=true -Dgpg.skip -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -B -Dmaven.repo.local=./build/.m2/repository
73+
74+
- name: docker - sonar qube on master
75+
if: github.ref == 'refs/heads/master'
76+
run: mvn sonar:sonar -q "-Dsonar.branch.name=${GITHUB_REF}" "-Dsonar.host.url=${SONAR_URL}" "-Dsonar.login=${SONAR_TOKEN}" "-Dsonar.organization=${SONAR_ORGANISATION}"
77+
- name: docker - sonar qube on master
78+
if: github.ref != 'refs/heads/master'
79+
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}"
80+
81+
- name: run unit tests with coverage reports
82+
run: mvn test -q && bash <(curl -s https://codecov.io/bash)
83+
84+
- name: deploy to maven cental
85+
if: github.ref == 'refs/heads/master'
86+
run: $DOCKER_COMMAND echo $GPG_SECRET_KEYS | base64 --decode | $GPG_EXECUTABLE --import && echo $GPG_OWNERTRUST | base64 --decode | $GPG_EXECUTABLE --import-ownertrust && mvn clean deploy --settings default.xml -B -P release
87+
88+
- uses: meeDamian/[email protected]
89+
if: github.ref == 'refs/heads/master'
90+
with:
91+
token: ${{ secrets.GITHUB_TOKEN }}
92+
tag: ${CURRENT_VERSION}
93+
name: ${CURRENT_VERSION}
94+
body: $GIT_RELEASE_NOTES
95+
files: >
96+
aemdesign-aem-core-deploy/target/aemdesign-aem-core-deploy-$CURRENT_VERSION.zip
97+
aemdesign-aem-services/target/aemdesign-aem-services-$CURRENT_VERSION.jar
98+
aemdesign-aem-author/target/aemdesign-aem-author-$CURRENT_VERSION.zip
99+
aemdesign-aem-common/target/aemdesign-aem-common-$CURRENT_VERSION.zip
100+
101+
- name: trigger build of bundle docker container
102+
if: github.ref == 'refs/heads/master'
103+
run: |
104+
docker run --rm aemdesign/travis-trigger-build sbb --github_user=${GITHUB_USER} --github_repo=aem --github_branch=6.5.0-bundle --travis_token=${TRAVIS_TOKEN}
105+
docker run --rm aemdesign/travis-trigger-build sbb --github_user=${GITHUB_USER} --github_repo=aem --github_branch=6.4.0-bundle --travis_token=${TRAVIS_TOKEN}
106+
107+
- name: automation test if failure
108+
run: |
109+
df
110+
docker ps -a
111+
docker logs -t service_aem_container_name
112+
if: failure()
113+

0 commit comments

Comments
 (0)