Samples: add icon and banner to sample application #976
Workflow file for this run
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: Java CI | |
on: [push, pull_request] | |
env: | |
JAVA_REFERENCE_VERSION: 11 | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04] | |
java: [11, 17, 19] | |
fail-fast: false | |
max-parallel: 4 | |
name: Test JDK ${{ matrix.java }}, ${{ matrix.os }} | |
environment: coverage # open environment, no critical secrets | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 25 | |
- name: Set version environment for version string | |
run: | | |
export REV=${GITHUB_REF#refs/*/} | |
echo "REVISION=${REV/\//-}" >> $GITHUB_ENV | |
if [[ "${GITHUB_REF#refs/tags/}" =~ ^${{ env.JAVA_REFERENCE_VERSION }}\.[0-9]*\.[0-9]*$ ]]; then | |
echo "CHANGELIST=" >> $GITHUB_ENV | |
else | |
echo "CHANGELIST=-SNAPSHOT" >> $GITHUB_ENV | |
fi | |
echo "github ref: ${GITHUB_REF}" | |
echo "setting env:" | |
cat ${GITHUB_ENV} | |
- name: Cache the Maven packages to speed up build | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Set up JDK ${{ env.JAVA_REFERENCE_VERSION }} | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: 'adopt' | |
- name: Test with Maven | |
run: mvn -Dgpg.skip=true --no-transfer-progress --batch-mode -Drevision=${REVISION} -Dchangelist=${CHANGELIST} package | |
- name: CodeCov coverage Reporter | |
uses: codecov/codecov-action@v3 | |
if: matrix.java == env.JAVA_REFERENCE_VERSION | |
- name: Codacy coverage Reporter | |
if: matrix.java == env.JAVA_REFERENCE_VERSION | |
continue-on-error: true # codacy coverage sometimes fails for external PRs, ignore since it is not our main coverage tracking | |
uses: codacy/codacy-coverage-reporter-action@v1 | |
with: | |
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
publish: | |
name: Deploy to github packages and Sonatype OSSRH | |
needs: test | |
runs-on: ubuntu-22.04 | |
environment: deploy | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set version environment for version string | |
run: | | |
export REV=${GITHUB_REF#refs/*/} | |
echo "REVISION=${REV/\//-}" >> $GITHUB_ENV | |
if [[ "${GITHUB_REF#refs/tags/}" =~ ^${{ env.JAVA_REFERENCE_VERSION }}\.[0-9]*\.[0-9]*$ ]]; then | |
echo "CHANGELIST=" >> $GITHUB_ENV | |
else | |
echo "CHANGELIST=-SNAPSHOT" >> $GITHUB_ENV | |
fi | |
echo "github ref: ${GITHUB_REF}" | |
echo "setting env:" | |
cat ${GITHUB_ENV} | |
- name: Cache the Maven packages to speed up build | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Set up the JDK ${{ env.JAVA_REFERENCE_VERSION }} | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ env.JAVA_REFERENCE_VERSION }} | |
distribution: 'adopt' | |
gpg-private-key: ${{ secrets.GPG_KEY }} | |
gpg-passphrase: GPG_PASS | |
- name: Deploy to Github Packages | |
run: if [ -z "$CHANGELIST" ]; then mvn -DskipTests --no-transfer-progress --batch-mode -Drevision=${REVISION} -Dchangelist=${CHANGELIST} -Drelease=github deploy; fi | |
continue-on-error: true # allows to restart the deployment step and not have the existing deployed github package prevent publishing to maven central | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GPG_PASS: ${{ secrets.GPG_PASSPHRASE }} | |
- name: Set up JDK to publish to OSSRH | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ env.JAVA_REFERENCE_VERSION }} | |
distribution: 'adopt' | |
server-id: ossrh | |
server-username: SONATYPE_USER | |
server-password: SONATYPE_PASS | |
# gpg-private-key: ${{ secrets.GPG_KEY }} # gpg key was already added in the first java-setup phase, will fail the cleanup if added again | |
gpg-passphrase: GPG_PASS | |
- name: Deploy to Maven Central | |
run: mvn -DskipTests --no-transfer-progress --batch-mode -Drevision=${REVISION} -Dchangelist=${CHANGELIST} -Drelease=ossrh deploy | |
env: | |
GPG_PASS: ${{ secrets.GPG_PASSPHRASE }} | |
SONATYPE_USER: ${{ secrets.SONATYPE_USER }} | |
SONATYPE_PASS: ${{ secrets.SONATYPE_PASS }} | |
... |