name: Urlaubsverwaltung CI

on:
  schedule:
    - cron: "2 4 * * *"
  push:
    branches:
      - master
      - v3.x
  pull_request:
  workflow_dispatch:

jobs:
  build:
    name: build and analyse
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
      - name: Set up JDK 11
        uses: actions/setup-java@v1
        with:
          java-version: 11
      - name: Cache npm dependencies
        uses: actions/cache@v2
        with:
          path: ~/.npm
          key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-node-
      - name: Cache pom dependencies
        uses: actions/cache@v2
        with:
          path: |
            ~/.m2/repository
            node/
          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
          restore-keys: |
            ${{ runner.os }}-maven-
      - name: Build
        run: ./mvnw --batch-mode clean verify
      - uses: actions/upload-artifact@v2
        if: ${{ always() }}
        with:
          name: failed-selenium-tests
          path: target/FAILED-*.flv
      - name: Build docker image and push to GitHub Container Registry
        if: github.ref == 'refs/heads/master'
        run: >
          ./mvnw --batch-mode
          docker:build
          docker:push
          -Ddocker.name=synyx/urlaubsverwaltung
          -Ddocker.push.registry=ghcr.io
          -Ddocker.push.username=${{ github.actor }}
          -Ddocker.push.password=${{ secrets.CR_PAT }}
          -Ddocker.pull.username=${{ secrets.DOCKER_USERNAME }}
          -Ddocker.pull.password=${{ secrets.DOCKER_PASSWORD }}

name: Urlaubsverwaltung CI

on:
  schedule:
    - cron: "2 4 * * *"
  push:
    branches:
      - master
      - v3.x
  pull_request:
  workflow_dispatch:

jobs:
  build:
    name: build and analyse
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
      - name: Set up JDK 11
        uses: actions/setup-java@v1
        with:
          java-version: 11
      - name: Cache npm dependencies
        uses: actions/cache@v2
        with:
          path: ~/.npm
          key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-node-
      - name: Cache pom dependencies
        uses: actions/cache@v2
        with:
          path: |
            ~/.m2/repository
            node/
          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
          restore-keys: |
            ${{ runner.os }}-maven-
      - name: Build
        run: ./mvnw --batch-mode clean verify
      - uses: actions/upload-artifact@v2
        if: ${{ always() }}
        with:
          name: failed-selenium-tests
          path: target/FAILED-*.flv

Remove Build docker image and push to GitHub Container Registry
Remove Build docker image and push to GitHub Container Registry
