diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6f2937a..36e5f44 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,56 +1,32 @@ -name: Build and Publish to Modrinth +name: Publish on: push: branches: - main + workflow_dispatch: -jobs: - test: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up SDK 21 - uses: actions/setup-java@v4 - with: - distribution: temurin - java-version: 21 - - - run: chmod +x ./gradlew - - - name: Run tests - run: ./gradlew test - - build: - runs-on: ubuntu-latest - needs: test - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up SDK 21 - uses: actions/setup-java@v4 - with: - distribution: temurin - java-version: 21 - - - run: chmod +x ./gradlew - - - name: Build - run: ./gradlew build +jobs: publish: runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' needs: build steps: - name: Checkout uses: actions/checkout@v4 + - name: Cache Gradle + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + gradle-${{ runner.os }} + - name: Set up SDK 21 uses: actions/setup-java@v4 with: @@ -60,6 +36,6 @@ jobs: - run: chmod +x ./gradlew - name: Publish on Modrinth - run: ./gradlew modrinth + run: ./gradlew modrinth --no-daemon env: - MODRINTH_SECRET: ${{ secrets.MODRINTH_SECRET }} \ No newline at end of file + MODRINTH_SECRET: ${{ secrets.MODRINTH_SECRET }}