Main Build #590
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} | |
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }} | |
- 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.MAVEN_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
CI_DEPLOY_USERNAME: ${{ secrets.MAVEN_USERNAME }} | |
CI_DEPLOY_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} | |
GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }} | |
GPG_PASSPHASE: ${{ secrets.GPG_PASSPHRASE }} | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }} | |
- 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 }} |