project & pom #194
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: Build and Deploy | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- 'v[0-9]+.*' | |
pull_request: | |
branches: | |
- master | |
env: | |
MAVEN_OPTS: "-Xmx4G -Dhttps.protocols=TLSv1.2 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true" | |
jobs: | |
builds: | |
if: ${{ !(github.ref == 'refs/heads/master' && contains(github.event.head_commit.message, '[maven-release-plugin]')) }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Cache Maven packages | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2 | |
key: m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: m2 | |
- name: Compile, Generate and Test (never fails) | |
run: mvn -B -Dmaven.test.failure.ignore -Drascal.test.memory=4 test | |
- name: Publish Test Report | |
uses: EnricoMi/publish-unit-test-result-action/composite@v1 | |
if: ${{ always() && github.event_name != 'pull_request' }} # to bad this doesn't work nicely with external pull requests | |
with: | |
files: target/surefire-reports/**/*.xml | |
check_run_annotations: 'all tests, skipped tests' | |
- name: Attach artifact | |
id: build-artifact | |
uses: SWAT-engineering/maven-full-artifacts-action@v1 | |
with: | |
maven-options: -Drascal.generate.skip | |
- name: Prepare Draft Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
draft: true | |
files: ${{ steps.build-artifact.outputs.artifact-root-dir}}/**/* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Deploy | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: usethesource/releases-maven-action@v1 | |
with: | |
maven-username: ${{ secrets.RELEASE_MAVEN_USERNAME }} | |
maven-password: ${{ secrets.RELEASE_MAVEN_PASSWORD }} | |
maven-local-port: ${{ secrets.RELEASE_MAVEN_LOCAL_PORT }} | |
ssh-hostname: ${{ secrets.RELEASE_SSH_SERVER }} | |
ssh-known-host: ${{ secrets.RELEASE_SSH_KNOWN_HOSTS }} | |
ssh-username: ${{ secrets.RELEASE_SSH_USERNAME }} | |
ssh-private-key: ${{ secrets.RELEASE_SSH_PRIVATE_KEY }} | |
maven-options: "-Drascal.generate.skip" |