|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + publish_release: |
| 9 | + description: Publish release |
| 10 | + type: boolean |
| 11 | + default: false |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + permissions: |
| 17 | + contents: write |
| 18 | + |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v2 |
| 21 | + |
| 22 | + - name: Install packwiz |
| 23 | + run: go install github.com/packwiz/packwiz@latest |
| 24 | + |
| 25 | + - name: Add Go bin to PATH |
| 26 | + run: echo "$HOME/go/bin" >> "$GITHUB_PATH" |
| 27 | + |
| 28 | + - name: Read versions |
| 29 | + id: vars |
| 30 | + run: | |
| 31 | + VERSION=$(awk -F'"' '$1 ~ /version =/ {print $2; exit}' pack.toml) |
| 32 | + echo "version=$VERSION" >> "$GITHUB_OUTPUT" |
| 33 | + echo "mc=1.21.10" >> "$GITHUB_OUTPUT" |
| 34 | +
|
| 35 | + - name: Export pack |
| 36 | + run: packwiz modrinth export |
| 37 | + |
| 38 | + - name: Rename pack (push/pr or no release) |
| 39 | + if: github.event_name != 'workflow_dispatch' || inputs.publish_release != 'true' |
| 40 | + run: | |
| 41 | + mv "Lemon Packet-${{ steps.vars.outputs.version }}.mrpack" \ |
| 42 | + "Lemon-Packet-v${{ steps.vars.outputs.version }}-mc${{ steps.vars.outputs.mc }}-build.${{ github.run_number }}.mrpack" |
| 43 | +
|
| 44 | + - name: Rename pack (release) |
| 45 | + if: github.event_name == 'workflow_dispatch' && inputs.publish_release == 'true' |
| 46 | + run: | |
| 47 | + mv "Lemon Packet-${{ steps.vars.outputs.version }}.mrpack" \ |
| 48 | + "Lemon-Packet-v${{ steps.vars.outputs.version }}-mc${{ steps.vars.outputs.mc }}.mrpack" |
| 49 | +
|
| 50 | + - name: Upload artifact (push/pr or no release) |
| 51 | + if: github.event_name != 'workflow_dispatch' || inputs.publish_release != 'true' |
| 52 | + uses: actions/upload-artifact@v4 |
| 53 | + with: |
| 54 | + path: Lemon-Packet-v${{ steps.vars.outputs.version }}-mc${{ steps.vars.outputs.mc }}-build.${{ github.run_number }}.mrpack |
| 55 | + |
| 56 | + - name: Publish release |
| 57 | + if: github.event_name == 'workflow_dispatch' && inputs.publish_release == 'true' |
| 58 | + uses: Kir-Antipov/mc-publish@v3.3 |
| 59 | + with: |
| 60 | + files: Lemon-Packet-v${{ steps.vars.outputs.version }}-mc${{ steps.vars.outputs.mc }}.mrpack |
| 61 | + name: ${{ format('{0} v{1} for mc{2}', 'Lemon Packet', steps.vars.outputs.version, '1.21.10') }} |
| 62 | + version: v${{ steps.vars.outputs.version }} |
| 63 | + modrinth-id: AABBCCDD |
| 64 | + modrinth-token: ${{ secrets.MODRINTH_TOKEN }} |
| 65 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments