Ondersteuning voor referentie-implementatie #516
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: Maven CI/CD | |
on: | |
push: | |
branches: | |
- master | |
- release-* | |
pull_request: | |
branches: | |
- master | |
- release-* | |
jobs: | |
build_and_test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Cache the Maven packages to speed up build | |
uses: actions/cache@v1 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Setup timezone | |
uses: zcong1993/setup-timezone@master | |
with: | |
timezone: Europe/Amsterdam | |
- name: Build project with Maven | |
run: mvn -B package --file pom.xml | |
start_docker_container_and_publish_image: | |
needs: build_and_test | |
runs-on: ubuntu-latest | |
env: | |
MAX_APP_START_TIME: 30 | |
WAIT_INTERVAL: 3 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Login to Docker Hub | |
if: ${{ github.event_name == 'push'}} | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Cache the Maven packages to speed up build | |
uses: actions/cache@v1 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: start container | |
run: | | |
chmod +x docker_start.sh | |
./docker_start.sh | |
- name: publish image | |
if: ${{ github.event_name == 'push'}} | |
run: | | |
chmod +x docker_push.sh | |
export BRANCH_NAME=${GITHUB_REF##*/} | |
export EVENT_TYPE=push | |
./docker_push.sh | |
publish_package_to_nexus: | |
needs: start_docker_container_and_publish_image | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Cache the Maven packages to speed up build | |
uses: actions/cache@v1 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- uses: s4u/maven-settings-action@v2.4.1 | |
if: ${{ github.event_name == 'push'}} | |
with: | |
servers: | | |
[{ | |
"id": "openzaakbrug-nexus", | |
"username": "${{ secrets.NEXUS_USERNAME }}", | |
"password": "${{ secrets.NEXUS_PASSWORD }}" | |
}] | |
- name: Publish to Nexus | |
if: ${{ github.event_name == 'push'}} | |
run: mvn --batch-mode deploy -P build-as-library --file pom.xml |