|
| 1 | +name: Build and Test |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + pull_request: |
| 7 | + types: |
| 8 | + - opened |
| 9 | + - synchronize |
| 10 | + |
| 11 | +jobs: |
| 12 | + generate-artifact-name: |
| 13 | + runs-on: self-hosted |
| 14 | + outputs: |
| 15 | + name: ${{ steps.name.outputs.name }} |
| 16 | + steps: |
| 17 | + - name: Generate Name |
| 18 | + id: name |
| 19 | + run: | |
| 20 | + if [[ "${{ github.event_name }}" == 'pull_request' ]]; then |
| 21 | + suffix="PR ${{ github.event.number }}" |
| 22 | + else |
| 23 | + ref="${{ github.ref }}" |
| 24 | + ref="${ref#refs/heads/}" |
| 25 | + suffix="${ref//\//-}" |
| 26 | + fi |
| 27 | + name="AdvancedPeripherals $suffix" |
| 28 | + echo "name: $name" |
| 29 | + echo "name=$name" >> "$GITHUB_OUTPUT" |
| 30 | +
|
| 31 | + build-and-test: |
| 32 | + needs: |
| 33 | + - generate-artifact-name |
| 34 | + uses: IntelligenceModding/actions/.github/workflows/build-and-test.yaml@master |
| 35 | + with: |
| 36 | + build_name: ${{ needs.generate-artifact-name.outputs.name }} |
| 37 | + pr: ${{ github.event_name == 'pull_request' && github.event.number || '' }} |
| 38 | + check: ${{ github.event_name != 'push' }} |
| 39 | + |
| 40 | + publish: |
| 41 | + if: ${{ github.event_name == 'push' && contains(github.ref, 'release/') }} |
| 42 | + runs-on: self-hosted |
| 43 | + needs: |
| 44 | + - build-and-test |
| 45 | + steps: |
| 46 | + - name: Checkout sources |
| 47 | + uses: actions/checkout@v4 |
| 48 | + - name: Setup Gradle |
| 49 | + uses: gradle/actions/setup-gradle@v4 |
| 50 | + - name: Download Builds |
| 51 | + uses: actions/download-artifact@v4 |
| 52 | + with: |
| 53 | + name: ${{ needs.build-and-test.outputs.artifact-name }} |
| 54 | + path: build/libs |
| 55 | + - name: Patch Changelog |
| 56 | + run: ./gradlew patchChangelog |
| 57 | + - name: Github Release |
| 58 | + run: ./gradlew githubRelease |
| 59 | + - name: Publish Maven |
| 60 | + run: ./gradlew publishAllPublicationsToPublicRepository |
| 61 | + - name: Publish Modrinth |
| 62 | + run: ./gradlew modrinth |
| 63 | + - name: Publish CurseForge |
| 64 | + run: ./gradlew publishCurseForge |
0 commit comments