Merge branch 'multi-api' #30
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- '*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
version: ['1.19', '1.19.1', '1.19.2', '1.19.3', '1.19.4', '1.20', '1.20.1', '1.20.2'] | |
fail-fast: true | |
steps: | |
- name: Check out project | |
if: success() | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 17 | |
if: success() | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'microsoft' | |
- name: Setup Gradle | |
if: success() | |
uses: gradle/gradle-build-action@v2 | |
with: | |
gradle-version: 8.3 | |
- name: Build | |
if: success() | |
run: gradle remapJar -Pv=${{ matrix.version }} | |
- name: Upload artifact | |
if: success() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-${{ matrix.version }} | |
path: | | |
**/libs/server-portals-*.jar | |
release: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Check out metadata | |
uses: actions/checkout@v3 | |
with: | |
sparse-checkout: | | |
README.md | |
CHANGELOG.md | |
LICENSE | |
- name: Download artifacts | |
if: success() | |
uses: actions/download-artifact@v3 | |
- name: Release on github | |
if: success() # No git tag check, since action-gh-release fails if not valid | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
**/libs/server-portals-*.jar | |
README.md | |
CHANGELOG.md | |
LICENSE | |
body_path: CHANGELOG.md | |
draft: false | |
prerelease: false | |
fail_on_unmatched_files: true | |
publish: | |
runs-on: ubuntu-latest | |
needs: release | |
strategy: | |
matrix: | |
version: ['1.19', '1.19.1', '1.19.2', '1.19.3', '1.19.4', '1.20', '1.20.1', '1.20.2'] | |
fail-fast: true | |
steps: | |
- name: Check out metadata | |
uses: actions/checkout@v3 | |
with: | |
sparse-checkout: | | |
CHANGELOG.md | |
- name: Download artifact | |
if: success() | |
uses: actions/download-artifact@v3 | |
with: | |
name: build-${{ matrix.version }} | |
- name: Publish on modrinth | |
if: success() && startsWith(github.ref, 'refs/tags/') # Failsafe check | |
# See https://github.com/Kir-Antipov/mc-publish | |
uses: Kir-Antipov/[email protected] | |
with: | |
modrinth-id: server-portals | |
modrinth-token: ${{ secrets.MODRINTH_TOKEN }} | |
modrinth-featured: false | |
files: | | |
**/libs/server-portals-*.jar | |
name: Server Portals ${{ github.ref_name }} | |
version: ${{ github.ref_name }}+${{ matrix.version }} | |
version-type: "${{ contains(github.ref_name, 'SNAPSHOT') && 'alpha' || 'release' }}" | |
changelog-file: CHANGELOG.md | |
#loaders: fabric | |
game-versions: "=${{ matrix.version }}" | |
#dependencies: | |
publish_readme: | |
runs-on: ubuntu-latest | |
needs: publish | |
steps: | |
- name: Check out metadata | |
uses: actions/checkout@v3 | |
with: | |
sparse-checkout: | | |
README.md | |
- name: Update readme | |
if: success() | |
run: | | |
readme="$(sed 's/\\/\\\\/g; s/"/\\"/g; s/$/\\n/' README.md)" | |
json="{ \"body\": \"$readme\" }" | |
echo "$json" | curl -XPATCH -H "Authorization: ${{ secrets.MODRINTH_TOKEN }}" -H "Content-type: application/json" -d @- 'https://api.modrinth.com/v2/project/server-portals' |