|
| 1 | +# A deployment template that works out of the box |
| 2 | +# It supports these objectives: |
| 3 | +# - Deploy to Maven (Build Job) [Secrets: MAVEN_USER, MAVEN_PASS] |
| 4 | +# - Deploy to CurseForge (Upload Job) [Secrets: CURSEFORGE_TOKEN] |
| 5 | +# - Deploy to Modrinth (Upload Job) [Secrets: MODRINTH_TOKEN] |
| 6 | + |
| 7 | +name: Deploy |
| 8 | + |
| 9 | +on: |
| 10 | + push: |
| 11 | + tags: |
| 12 | + - '[0-9]+.[0-9]+.[0-9]+' |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - name: Checkout Repository |
| 19 | + uses: actions/checkout@v3 |
| 20 | + |
| 21 | + - name: Grant Execute Permission for gradlew |
| 22 | + run: chmod +x gradlew |
| 23 | + |
| 24 | + - name: Read gradle.properties |
| 25 | + uses: BrycensRanch/read-properties-action@v1 |
| 26 | + id: properties |
| 27 | + with: |
| 28 | + file: gradle.properties |
| 29 | + all: true |
| 30 | + |
| 31 | + - name: Setup Java |
| 32 | + uses: actions/setup-java@v3 |
| 33 | + with: |
| 34 | + java-version: '17' |
| 35 | + distribution: 'zulu' |
| 36 | + cache: gradle |
| 37 | + |
| 38 | + - name: Publish to Maven |
| 39 | + if: steps.properties.outputs.publish_to_maven == 'true' && steps.properties.outputs.publish_to_local_maven == 'true' |
| 40 | + uses: gradle/gradle-build-action@v2 |
| 41 | + with: |
| 42 | + arguments: | |
| 43 | + publish |
| 44 | + -P${{ steps.properties.outputs.maven_name }}Username=${{ secrets.MAVEN_USER }} |
| 45 | + -P${{ steps.properties.outputs.maven_name }}Password=${{ secrets.MAVEN_PASS }} |
| 46 | +
|
| 47 | + - name: Publish to CurseForge |
| 48 | + if: steps.properties.outputs.publish_to_curseforge == 'true' |
| 49 | + uses: gradle/gradle-build-action@v2 |
| 50 | + env: |
| 51 | + CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} |
| 52 | + with: |
| 53 | + arguments: curseforge |
| 54 | + |
| 55 | + - name: Publish to Modrinth |
| 56 | + if: steps.properties.outputs.publish_to_modrinth == 'true' |
| 57 | + uses: gradle/gradle-build-action@v2 |
| 58 | + env: |
| 59 | + MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} |
| 60 | + with: |
| 61 | + arguments: modrinth |
0 commit comments