(dep) add missing dependency #157
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
on: | |
push: | |
tags: | |
- 1.* | |
- 2.* | |
- 3.* | |
branches: | |
- development | |
- release-prep | |
paths-ignore: | |
- '**.md' | |
env: | |
MAVEN_CLI_OPTS: "--batch-mode --update-snapshots" | |
JAVA_JDKVERSION_TAG: "jdk-11" | |
SET_VERSION: | | |
ARTIFACT_ID=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.artifactId}' --non-recursive exec:exec); | |
echo "ARTIFACT_ID=$ARTIFACT_ID" >> $GITHUB_ENV; | |
jobs: | |
###################### Setup ###################### | |
setup: | |
runs-on: ubuntu-latest | |
container: maven:3.6-adoptopenjdk-11 | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- run: export | |
- uses: actions/checkout@v3 | |
- name: set ARTIFACT_ID | |
run: | | |
ARTIFACT_ID=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.artifactId}' --non-recursive exec:exec); | |
echo "ARTIFACT_ID=$ARTIFACT_ID" >> $GITHUB_ENV; | |
- name: set RELEASE version | |
run: | | |
ARTIFACT_VERSION=${GITHUB_REF/refs\/tags\//}-$JAVA_JDKVERSION_TAG; | |
echo ARTIFACT_VERSION=$ARTIFACT_VERSION >> $GITHUB_ENV; | |
echo ARTIFACT_FULLNAME=$ARTIFACT_ID-$ARTIFACT_VERSION >> $GITHUB_ENV; | |
if: startsWith(github.ref, 'refs/tags/') | |
- name: set SNAPSHOT version | |
run: | | |
ARTIFACT_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec); | |
echo ARTIFACT_VERSION=$ARTIFACT_VERSION >> $GITHUB_ENV; | |
echo ARTIFACT_FULLNAME=$ARTIFACT_ID-$ARTIFACT_VERSION >> $GITHUB_ENV; | |
if: startsWith(github.ref, 'refs/heads/') | |
- name: set ARTIFACT_FULLNAME | |
run: | | |
echo "echo ARTIFACT_ID=${ARTIFACT_ID} >> \$GITHUB_ENV" >> dot.env | |
echo "echo ARTIFACT_VERSION=${ARTIFACT_VERSION} >> \$GITHUB_ENV" >> dot.env | |
echo "echo ARTIFACT_FULLNAME=${ARTIFACT_FULLNAME} >> \$GITHUB_ENV" >> dot.env | |
- run: export | |
- name: Upload setupfile | |
uses: actions/upload-artifact@v3 | |
with: | |
name: setup | |
path: dot.env | |
if-no-files-found: error | |
retention-days: 1 | |
###################### Test / Build ###################### | |
build_jdk11: | |
runs-on: ubuntu-latest | |
needs: | |
- setup | |
container: maven:3.6-adoptopenjdk-11 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache Maven packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Download dot.env | |
uses: actions/download-artifact@v3 | |
with: | |
name: setup | |
- run: bash dot.env | |
- run: mvn versions:set -DnewVersion=$ARTIFACT_VERSION | |
- run: mvn $MAVEN_CLI_OPTS clean package -Dmaven.test.skip=true | |
- name: Upload build artifact for assembly | |
uses: actions/upload-artifact@v2 | |
with: | |
name: build_jdk11 | |
path: target/*.jar | |
if-no-files-found: error | |
retention-days: 5 | |
test_jdk11: | |
runs-on: ubuntu-latest | |
needs: | |
- setup | |
container: maven:3.6-adoptopenjdk-11 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache Maven packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Download dot.env | |
uses: actions/download-artifact@v3 | |
with: | |
name: setup | |
- run: bash dot.env | |
- run: mvn versions:set -DnewVersion=$ARTIFACT_VERSION | |
- run: mvn $MAVEN_CLI_OPTS clean org.jacoco:jacoco-maven-plugin:prepare-agent test jacoco:report | |
- run: awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, " instructions covered"; print 100*covered/instructions, "% covered" }' target/site/jacoco/jacoco.csv | |
- run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report | |
shell: bash | |
env: | |
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
###################### Deploy ###################### | |
publish_jdk11: | |
runs-on: ubuntu-latest | |
needs: | |
- test_jdk11 | |
- build_jdk11 | |
container: maven:3.6-adoptopenjdk-11 | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache Maven packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Download dot.env | |
uses: actions/download-artifact@v3 | |
with: | |
name: setup | |
- run: bash dot.env | |
- run: mvn versions:set -DnewVersion=$ARTIFACT_VERSION | |
- run: apt update && apt -y install gnupg | |
- name: generate key | |
run: gpg --batch --import <(echo "$GPG_PRIVATE_KEY_ENCODED" | base64 -d) | |
env: | |
GPG_PRIVATE_KEY_ENCODED: ${{ secrets.GPG_PRIVATE_KEY_ENCODED }} | |
- name: Publish package | |
run: mvn -s .m2/settings.xml clean deploy -P release -Dmaven.test.skip=true -Dmaven.install.skip=true | |
env: | |
OSSRH_USERTOKEN: ${{ secrets.OSSRH_USERTOKEN }} | |
OSSRH_USERTOKEN_KEY: ${{ secrets.OSSRH_USERTOKEN_KEY }} | |
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
###################### Release ###################### | |
###################### Release & Publish ###################### | |
release_jdk11: | |
runs-on: ubuntu-latest | |
needs: | |
- test_jdk11 | |
- build_jdk11 | |
if: startsWith(github.ref, 'refs/tags/') | |
container: maven:3.6-adoptopenjdk-11 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download dot.env | |
uses: actions/download-artifact@v3 | |
with: | |
name: setup | |
- run: bash dot.env | |
- name: Cache Maven packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Download build_jdk11 for assembly | |
uses: actions/download-artifact@v3 | |
with: | |
name: build_jdk11 | |
path: target | |
- run: mvn versions:set -DnewVersion=$ARTIFACT_VERSION | |
- name: check content of target | |
run: cd target && ls | |
- run: mvn $MAVEN_CLI_OPTS site:site assembly:single -Dmaven.test.skip=true | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ env.ARTIFACT_VERSION }} | |
body: | | |
Changes in this Release | |
- First Change | |
- Second Change | |
draft: true | |
prerelease: false | |
- name: Upload zip Release Asset | |
id: upload-release-asset-zip | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: target/${{ env.ARTIFACT_FULLNAME }}-dist.zip | |
asset_name: ${{ env.ARTIFACT_FULLNAME }}-dist.zip | |
asset_content_type: application/zip | |
- name: Upload tar.gz Release Asset | |
id: upload-release-asset-tar | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: target/${{ env.ARTIFACT_FULLNAME }}-dist.tar.gz | |
asset_name: ${{ env.ARTIFACT_FULLNAME }}-dist.tar.gz | |
asset_content_type: application/zip | |