name: CI Build

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Set up JDK 13
      uses: actions/setup-java@v1.3.0
      with:
        java-version: 13

    - name: Gradle build cache
      uses: actions/cache@v1
      with:
        path: ~/.gradle/caches
        key: ${{ runner.os }}-gradle-build-${{ hashFiles('**/*.gradle*') }}
        restore-keys: ${{ runner.os }}-gradle-build-

    - name: Gradle wrapper cache
      uses: actions/cache@v1
      with:
        path: ~/.gradle/wrapper
        key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle-wrapper.properties') }}

    - name: Build with Gradle
      run: ./gradlew build

    - name: Docker push
      uses: docker/build-push-action@v1
      with:
        path: ./sw-server
        username: ${{ github.actor }}
        password: ${{ github.token }}
        registry: docker.pkg.github.com
        repository: joffrey-bion/seven-wonders/sw-server
        tag_with_ref: true
        tag_with_sha: true

name: CI Build

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Set up JDK 13
      uses: actions/setup-java@v1.3.0
      with:
        java-version: 13

    - name: Gradle build cache
      uses: actions/cache@v1
      with:
        path: ~/.gradle/caches
        key: ${{ runner.os }}-gradle-build-${{ hashFiles('**/*.gradle*') }}
        restore-keys: ${{ runner.os }}-gradle-build-

    - name: Gradle wrapper cache
      uses: actions/cache@v1
      with:
        path: ~/.gradle/wrapper
        key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle-wrapper.properties') }}

    - name: Build with Gradle
      run: ./gradlew build

    - name: Docker push to GitHub Packages
      uses: docker/build-push-action@v1
      with:
        path: ./sw-server
        username: ${{ github.actor }}
        password: ${{ github.token }}
        registry: docker.pkg.github.com
        repository: joffrey-bion/seven-wonders/sw-server
        tag_with_ref: true
        tag_with_sha: true

    - name: Docker push to Heroku
      uses: docker/build-push-action@v1
      with:
        path: ./sw-server
        username: _
        password: ${{ secrets.HEROKU_API_KEY }}
        registry: registry.heroku.com
        repository: seven-wonders-online/web
        tag_with_ref: true
        tag_with_sha: true

Add docker push to Heroku
Add docker push to Heroku
