name: JDK14

on:
  push:
    branches:
      - master
    paths:
      - 'Casks/zulu-jdk14.rb'
  pull_request:
    branches:
      - master
    paths:
      - 'Casks/zulu-jdk14.rb'

jobs:

  build:
    name: Build
    runs-on: macos-latest
    steps:

      - name: Check out
        uses: actions/checkout@v3

      - name: brew pull & reset & tap
        run: |
          brew update-reset "$(brew --repository)"
          brew update-reset "$(brew --repository homebrew/cask)"
          mkdir -p $(brew --repo)/Library/Taps/mdogan
          ln -s $GITHUB_WORKSPACE $(brew --repo)/Library/Taps/mdogan/homebrew-zulu
        env:
          HOMEBREW_COLOR: 1
          HOMEBREW_DEVELOPER: 1

      - name: install jdk14
        run: brew install zulu-jdk14
        env:
          HOMEBREW_COLOR: 1
          HOMEBREW_DEVELOPER: 1

      - name: uninstall jdk14
        run: brew uninstall zulu-jdk14
        env:
          HOMEBREW_COLOR: 1
          HOMEBREW_DEVELOPER: 1
