name: CI
on:
  push:
  pull_request:
  workflow_dispatch:

env:
  JDK_JAVA_OPTIONS: "--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED"

jobs:
  test:
    strategy:
      matrix:
        os: [ubuntu-latest]
        java-version: [17]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-java@v2
        with:
          java-version: ${{ matrix.java-version }}
          distribution: "adopt"
      - name: Setup settings.xml
        run: cp settings.xml ~/.m2/settings.xml
      - name: Test
        run: |
          cd code
          mvn --batch-mode test
  deploy:
    if: github.ref == 'refs/heads/master' && github.repository_owner == 'Codeforces'
    needs: test
    runs-on: windows-latest
    permissions:
      contents: read
      packages: write
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-java@v2
        with:
          java-version: "17"
          distribution: "adopt"
      - name: Setup settings.xml
        run: cp settings.xml ~/.m2/settings.xml
      - name: Deploy
        run: |
          cd code
          mvn --batch-mode deploy -DskipTests
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

name: CI
on:
  push:
  pull_request:
  workflow_dispatch:

env:
  JDK_JAVA_OPTIONS: "--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED"
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
  test:
    strategy:
      matrix:
        os: [ubuntu-latest]
        java-version: [17]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-java@v2
        with:
          java-version: ${{ matrix.java-version }}
          distribution: "adopt"
      - name: Setup settings.xml
        run: cp settings.xml ~/.m2/settings.xml
      - name: Test
        run: |
          cd code
          mvn --batch-mode test
  deploy:
    if: github.ref == 'refs/heads/master' && github.repository_owner == 'Codeforces'
    needs: test
    runs-on: windows-latest
    permissions:
      contents: read
      packages: write
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-java@v2
        with:
          java-version: "17"
          distribution: "adopt"
      - name: Setup settings.xml
        run: cp settings.xml ~/.m2/settings.xml
      - name: Deploy
        run: |
          cd code
          mvn --batch-mode deploy -DskipTests

Make GITHUB_TOKEN available for all jobs
Make GITHUB_TOKEN available for all jobs
