-
Notifications
You must be signed in to change notification settings - Fork 67
104 lines (84 loc) · 3.05 KB
/
maven.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
name: Main Build
on:
push:
branches: [ main ]
tags:
- '*'
paths-ignore:
- '.github/**'
- '*.md'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Build and Test
run: |
mvn -B -P tests -Dmaven.javadoc.skip=true install jacoco:report --file pom.xml
# temporarily disabled as codecov not available
# bash <(curl -s https://codecov.io/bash)
env:
AWS_REGION: ${{ secrets.AWS_REGION }}
- name: Publish JARs
run: |
#!/bin/bash
set -eux
if [[ "${GITHUB_REF}" == *"tags"* ]]; then
TAG="${GITHUB_REF#refs/tags/}"
mvn org.codehaus.mojo:versions-maven-plugin:2.1:set -DnewVersion="${TAG}"
fi
mvn -B -DskipTests=true -P ci,docs deploy --file pom.xml
env:
GITHUB_USERNAME: ${{ secrets.CI_USERNAME }}
GITHUB_PASSWORD: ${{ secrets.CI_PASSWORD }}
MAVEN_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }}
CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}
GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }}
GPG_PASSPHASE: ${{ secrets.GPG_PASSPHRASE }}
AWS_REGION: ${{ secrets.AWS_REGION }}
- name: Publish Docs
run: |
#!/bin/bash
set -eux
if [[ "${GITHUB_REF}" == *"tags"* ]]; then
TAG="${GITHUB_REF#refs/tags/}"
export BUILD_TYPE=release/"${TAG}"
mvn org.codehaus.mojo:versions-maven-plugin:2.1:set -DnewVersion="${TAG}"
else
export BUILD_TYPE=snapshot/"${GITHUB_REF#refs/heads/}"
fi
mvn -B -U -P docs generate-resources -DskipTests=true -Dmaven.javadoc.skip=true
git config --global user.email "${CI_EMAIL}"
git config --global user.name "${CI_USERNAME}"
set +x
mkdir -p ~/.ssh
echo "${CI_PRIVATE_KEY}" | tr -d '\r' > ~/.ssh/id_rsa
chmod 700 ~/.ssh/id_rsa
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_rsa
set -x
mkdir -p /tmp/spring-content-gh-pages
git clone --branch gh-pages [email protected]:paulcwarren/spring-content.git /tmp/spring-content-gh-pages
cp -R target/generated-docs/refs/* /tmp/spring-content-gh-pages/refs/
pushd /tmp/spring-content-gh-pages
git add .
git commit -m "Publishing reference guides for ${GITHUB_REF}"
git push origin gh-pages
popd
env:
CI_USERNAME: ${{ secrets.CI_USERNAME }}
CI_EMAIL: ${{ secrets.CI_EMAIL }}
CI_PRIVATE_KEY: ${{ secrets.CI_PRIVATE_KEY }}