name: Build

on:
  push:
    branches-ignore:
      - main

jobs:
  build:
    runs-on: ubuntu-latest
    env:
      CI_DEV_BUILD: true
    steps:
      - uses: actions/checkout@v3
      - name: Set up JDK 17
        uses: actions/setup-java@v3
        with:
          java-version: '17'
          distribution: 'temurin'
      - name: Setup build number
        run: echo "BUILD_NUMBER=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV
      - name: Make gradlew executable
        run: chmod +x ./gradlew
      - name: Build with Gradle
        uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25
        with:
          arguments: build
      - name: Upload Build Results
        uses: actions/upload-artifact@v3
        with:
          name: weather-changer-build
          path: |
            fabric/build/libs/*.jar
            forge/build/libs/*.jar