|
| 1 | +name: Build |
| 2 | +env: |
| 3 | + PLUGIN_NAME: LifeStealCore |
| 4 | + PLUGIN_FILE: lifestealcore |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: [ "main" ] |
| 9 | + pull_request: |
| 10 | + branches: [ "main" ] |
| 11 | + release: |
| 12 | + types: [created] |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + permissions: |
| 18 | + contents: read |
| 19 | + packages: write |
| 20 | + |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Set up JDK 17 |
| 25 | + uses: actions/setup-java@v4 |
| 26 | + with: |
| 27 | + java-version: '17' |
| 28 | + distribution: 'temurin' |
| 29 | + cache: maven |
| 30 | + |
| 31 | + - name: Build with Maven |
| 32 | + run: mvn -B package --file pom.xml |
| 33 | + |
| 34 | + - name: Debug Directory |
| 35 | + run: ls -la target/ |
| 36 | + |
| 37 | + - name: Upload Artifact |
| 38 | + uses: actions/upload-artifact@v4 |
| 39 | + with: |
| 40 | + name: ${{ env.PLUGIN_FILE }}-1.0.0 |
| 41 | + path: target/${{ env.PLUGIN_FILE }}-1.0.0.jar |
| 42 | + retention-days: 5 |
| 43 | + |
| 44 | + - name: Send Build Success Notification |
| 45 | + if: success() |
| 46 | + uses: sarisia/actions-status-discord@v1 |
| 47 | + with: |
| 48 | + webhook: ${{ secrets.DISCORD_WEBHOOK }} |
| 49 | + title: "✅ Build Success!" |
| 50 | + description: "A new build of ${{ env.PLUGIN_NAME }} has been created\nCommit: ${{ github.sha }}" |
| 51 | + color: 0x00ff00 |
| 52 | + username: "🏺Artifact Build's" |
| 53 | + avatar_url: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" |
| 54 | + |
| 55 | + - name: Send Build Failed Notification |
| 56 | + if: failure() |
| 57 | + uses: sarisia/actions-status-discord@v1 |
| 58 | + with: |
| 59 | + webhook: ${{ secrets.DISCORD_WEBHOOK }} |
| 60 | + title: "❌ Build Failed!" |
| 61 | + description: "The build for ${{ env.PLUGIN_NAME }} has failed\nCommit: ${{ github.sha }}" |
| 62 | + color: 0xff0000 |
| 63 | + username: "🏺Artifact Build's" |
| 64 | + avatar_url: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" |
| 65 | + |
| 66 | + release: |
| 67 | + needs: build |
| 68 | + if: github.event_name == 'release' |
| 69 | + runs-on: ubuntu-latest |
| 70 | + permissions: |
| 71 | + contents: write |
| 72 | + |
| 73 | + steps: |
| 74 | + - name: Download Artifact |
| 75 | + uses: actions/download-artifact@v4 |
| 76 | + with: |
| 77 | + name: ${{ env.PLUGIN_FILE }}-1.0.0 |
| 78 | + |
| 79 | + - name: Upload Release |
| 80 | + uses: softprops/action-gh-release@v2 |
| 81 | + with: |
| 82 | + files: ${{ env.PLUGIN_FILE }}-1.0.0.jar |
| 83 | + fail_on_unmatched_files: true |
| 84 | + |
| 85 | + - name: Send Release Success Notification |
| 86 | + if: success() |
| 87 | + uses: sarisia/actions-status-discord@v1 |
| 88 | + with: |
| 89 | + webhook: ${{ secrets.DISCORD_WEBHOOK }} |
| 90 | + title: "🎉 Release Published!" |
| 91 | + description: "Version 1.0.0 of ${{ env.PLUGIN_NAME }} is now available!\nDownload: https://github.com/${{ github.repository }}/releases/latest" |
| 92 | + color: 0x00ff00 |
| 93 | + username: "🏺Artifact Build's" |
| 94 | + avatar_url: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" |
| 95 | + |
| 96 | + - name: Send Release Failed Notification |
| 97 | + if: failure() |
| 98 | + uses: sarisia/actions-status-discord@v1 |
| 99 | + with: |
| 100 | + webhook: ${{ secrets.DISCORD_WEBHOOK }} |
| 101 | + title: "❌ Release Failed!" |
| 102 | + description: "The release for ${{ env.PLUGIN_NAME }} has failed\nVersion: 1.0.0" |
| 103 | + color: 0xff0000 |
| 104 | + username: "🏺Artifact Build's" |
| 105 | + avatar_url: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" |
0 commit comments