|
| 1 | +name: Publish to Modrinth |
| 2 | + |
| 3 | +# Triggers when you publish a GitHub Release |
| 4 | +on: |
| 5 | + release: |
| 6 | + types: [published] |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + tag: |
| 10 | + description: 'Release tag to publish (e.g. 2.6.0)' |
| 11 | + required: true |
| 12 | + type: string |
| 13 | + |
| 14 | +jobs: |
| 15 | + publish: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + permissions: |
| 18 | + contents: read |
| 19 | + |
| 20 | + steps: |
| 21 | + # 1. Check out the repository at the release tag |
| 22 | + - name: Checkout repository |
| 23 | + uses: actions/checkout@v4 |
| 24 | + |
| 25 | + # 2. Set up Java 21 |
| 26 | + - name: Set up Java 21 |
| 27 | + uses: actions/setup-java@v4 |
| 28 | + with: |
| 29 | + java-version: '21' |
| 30 | + distribution: 'temurin' |
| 31 | + |
| 32 | + # 3. Cache Maven dependencies to speed up builds |
| 33 | + - name: Cache Maven packages |
| 34 | + uses: actions/cache@v4 |
| 35 | + with: |
| 36 | + path: ~/.m2 |
| 37 | + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} |
| 38 | + restore-keys: ${{ runner.os }}-m2 |
| 39 | + |
| 40 | + # 4. Build the JAR |
| 41 | + # GIT_BRANCH=origin/master activates the Maven 'master' profile which |
| 42 | + # produces a clean version number (e.g. 2.6.0) without -SNAPSHOT/-LOCAL. |
| 43 | + - name: Build with Maven |
| 44 | + run: mvn -B clean package -DskipTests |
| 45 | + env: |
| 46 | + GIT_BRANCH: origin/master |
| 47 | + |
| 48 | + # 5. Upload the JAR to Modrinth |
| 49 | + # |
| 50 | + # Prerequisites — add these secrets in your GitHub repo settings |
| 51 | + # (Settings → Secrets and variables → Actions): |
| 52 | + # |
| 53 | + # MODRINTH_TOKEN — personal access token from https://modrinth.com/settings/pats |
| 54 | + # (scope: "Create versions") |
| 55 | + # MODRINTH_PROJECT_ID — your Modrinth project ID for AcidIsland, visible on the |
| 56 | + # project page under the three-dot menu ("Copy ID") |
| 57 | + # |
| 58 | + - name: Publish to Modrinth |
| 59 | + uses: cloudnode-pro/modrinth-publish@0be4916ad5f081d936eb5615aa35ce3f0949979c # v2 |
| 60 | + with: |
| 61 | + token: ${{ secrets.MODRINTH_TOKEN }} |
| 62 | + project: ${{ secrets.MODRINTH_PROJECT_ID }} |
| 63 | + |
| 64 | + # Use the release tag, or the manually supplied tag when triggered via workflow_dispatch |
| 65 | + version: ${{ github.event.release.tag_name || inputs.tag }} |
| 66 | + |
| 67 | + # Use the GitHub release body as the changelog (empty when run manually) |
| 68 | + changelog: ${{ github.event.release.body }} |
| 69 | + |
| 70 | + # AcidIsland is a BentoBox addon running on Paper-based servers |
| 71 | + loaders: |- |
| 72 | + paper |
| 73 | + purpur |
| 74 | +
|
| 75 | + # Minecraft versions supported (BentoBox API 3.12.0 targets Paper 1.21.11+) |
| 76 | + game-versions: |- |
| 77 | + 1.21.5 |
| 78 | + 1.21.6 |
| 79 | + 1.21.7 |
| 80 | + 1.21.8 |
| 81 | + 1.21.9 |
| 82 | + 1.21.10 |
| 83 | + 1.21.11 |
| 84 | + 26.1 |
| 85 | + 26.1.1 |
| 86 | +
|
| 87 | + # Path to the built JAR |
| 88 | + files: target/AcidIsland-${{ github.event.release.tag_name || inputs.tag }}.jar |
0 commit comments