diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index 27ab37f..463459c 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -1,101 +1,19 @@ name: Build PR -on: [pull_request] + +on: + pull_request: + permissions: - contents: write + contents: read checks: write - issues: write pull-requests: write + jobs: - build_pr: - if: github.repository_owner == 'OneLiteFeatherNET' - name: Build Pull Request Branch - runs-on: ${{ matrix.os }} - env: - ONELITEFEATHER_MAVEN_USERNAME: ${{ secrets.ONELITEFEATHER_MAVEN_USERNAME }} - ONELITEFEATHER_MAVEN_PASSWORD: ${{ secrets.ONELITEFEATHER_MAVEN_PASSWORD }} - strategy: - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - steps: - - name: Checkout Repository - uses: actions/checkout@v7 - - name: Setup Java - uses: actions/setup-java@v5 - with: - distribution: temurin - java-version: 24 - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v6 - - name: Build on ${{ matrix.os }} - run: ./gradlew clean build test - - name: Publish Test Results - uses: EnricoMi/publish-unit-test-result-action@v2 - if: always() && matrix.os == 'ubuntu-latest' - with: - files: "**/build/test-results/test/TEST-*.xml" - check_name: "Test Results" - comment_title: "Unit Test Results" - - name: Upload Test Report - uses: actions/upload-artifact@v7 - if: always() && matrix.os == 'ubuntu-latest' - with: - name: test-report - path: build/reports/tests/test/ - - name: Upload Coverage Reports - uses: actions/upload-artifact@v7 - if: always() && matrix.os == 'ubuntu-latest' - with: - name: coverage-report - path: build/reports/jacoco/test/ - upload_jar_and_comment: - name: Upload JAR and comment PR - permissions: - contents: write - pull-requests: write - runs-on: ubuntu-latest - needs: build_pr - if: contains(github.event.pull_request.labels.*.name, 'publish-pr') - steps: - - name: Checkout Repository - uses: actions/checkout@v7 - - name: Setup Java - uses: actions/setup-java@v5 - with: - distribution: temurin - java-version: 24 - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v6 - - name: Build - run: ./gradlew clean build test - - name: Upload JAR for PR - uses: actions/upload-artifact@v7 - with: - name: pr-jar - path: build/libs/*.jar - - name: Get JAR Artifact Download URL - id: get-artifact-url - uses: actions/github-script@v9 - with: - script: | - const runId = context.runId; - const artifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: runId - }); - const jarArtifact = artifacts.data.artifacts.find(a => a.name === 'pr-jar'); - if (!jarArtifact) throw new Error('pr-jar artifact not found'); - const url = jarArtifact.archive_download_url; - core.setOutput('jar_url', url); - - name: Create or Update PR Comment with direct JAR download link - uses: peter-evans/create-or-update-comment@v5 - with: - token: ${{ secrets.GITHUB_TOKEN }} - issue-number: ${{ github.event.pull_request.number }} - body: | - :package: A new JAR build is available! - [Download the JAR directly](${{ steps.get-artifact-url.outputs.jar_url }}) - - Note: The download link is valid for a limited time and requires GitHub authentication. - edit-mode: replace - comment-id: pr-jar-artifact-link + build: + # Shared org build: Temurin toolchain, 3-OS matrix, tests and coverage. + uses: OneLiteFeatherNET/workflows/.github/workflows/gradle-build-pr.yml@v2.8.1 + with: + java-version: "24" + java-distribution: "temurin" + run-tests: true + secrets: inherit diff --git a/.github/workflows/close_invalid_prs.yml b/.github/workflows/close_invalid_prs.yml index 432d368..bd99444 100644 --- a/.github/workflows/close_invalid_prs.yml +++ b/.github/workflows/close_invalid_prs.yml @@ -2,13 +2,9 @@ name: Close invalid PRs on: pull_request_target: - types: [ opened ] + types: [opened] jobs: - run: - if: ${{ github.repository != github.event.pull_request.head.repo.full_name && github.head_ref == 'main' }} - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: "Please do not open pull requests from the `main` branch, create a new branch instead." \ No newline at end of file + close: + uses: OneLiteFeatherNET/workflows/.github/workflows/close-invalid-prs.yml@v2.8.1 + secrets: inherit diff --git a/release-please-config.json b/release-please-config.json index 452bb4f..51533a2 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -6,24 +6,66 @@ "bootstrap-sha": "38c50b8336be3eb87a0512b6ae3ced117b0c5a3f", "pull-request-header": "", "changelog-sections": [ - { "type": "feat", "section": "Features" }, - { "type": "fix", "section": "Bug Fixes" }, - { "type": "perf", "section": "Performance Improvements" }, - { "type": "revert", "section": "Reverts" }, - { "type": "refactor", "section": "Code Refactoring" }, - { "type": "docs", "section": "Documentation", "hidden": true }, - { "type": "style", "section": "Styles", "hidden": true }, - { "type": "chore", "section": "Miscellaneous Chores", "hidden": true }, - { "type": "test", "section": "Tests", "hidden": true }, - { "type": "build", "section": "Build System", "hidden": true }, - { "type": "ci", "section": "Continuous Integration", "hidden": true } + { + "type": "feat", + "section": "Features" + }, + { + "type": "fix", + "section": "Bug Fixes" + }, + { + "type": "perf", + "section": "Performance Improvements" + }, + { + "type": "revert", + "section": "Reverts" + }, + { + "type": "refactor", + "section": "Code Refactoring" + }, + { + "type": "docs", + "section": "Documentation", + "hidden": true + }, + { + "type": "style", + "section": "Styles", + "hidden": true + }, + { + "type": "chore", + "section": "Miscellaneous Chores", + "hidden": true + }, + { + "type": "test", + "section": "Tests", + "hidden": true + }, + { + "type": "build", + "section": "Build System", + "hidden": true + }, + { + "type": "ci", + "section": "Continuous Integration", + "hidden": true + } ], "packages": { ".": { "package-name": "AntiRedstoneClock-Remastered", "changelog-path": "CHANGELOG.md", "extra-files": [ - { "type": "generic", "path": "build.gradle.kts" } + { + "type": "generic", + "path": "build.gradle.kts" + } ] } }