diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index 5454762..be04e09 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -1,4 +1,4 @@ -name: Publish on GitHub, CurseForge & Modrinth +name: Publish prerelease on GitHub, CurseForge & Modrinth on: push: @@ -10,9 +10,8 @@ on: env: MINECRAFT_VERSION: 1.19.2 JAVA_VERSION: 17 - MODRINTH_TOKEN: ${{ secrets.PUBLISH_MODRINTH_TOKEN }} - CURSEFORGE_TOKEN: ${{ secrets.PUBLISH_CURSEFORGE_TOKEN }} - GITHUB_TOKEN: ${{ secrets.PUBLISH_GITHUB_TOKEN }} + GITLAB_URL: https://git.griefed.de + GITLAB_PROJECT_ID: 119 permissions: contents: write @@ -36,10 +35,46 @@ jobs: - name: Use tag run: echo ${{steps.tag.outputs.tag}} + + # GET RELEASE INFO + - name: Get Release Info + run: | + curl --header \ + 'PRIVATE-TOKEN: ${{ secrets.GITLAB_TOKEN }}' \ + '${{ env.GITLAB_URL }}/api/v4/projects/${{ env.GITLAB_PROJECT_ID }}/releases/${{ needs.preparations.outputs.version }}' >> version.json + + # GET DESCRIPTION + - name: Extract version changelog + uses: sergeysova/jq-action@v2.3.0 + id: description + with: + cmd: "jq .description version.json -r | sed -e 's/\\n/\\n/g' > description.txt" + multiline: true + + - name: Dafuq # Otherwise we wouldn't be able to work with the file. Because reasons... + run: sudo chown $USER description.txt + + - name: Create Release + id: create_release + uses: softprops/action-gh-release@v0.1.15 + with: + token: ${{ secrets.GITHUB_TOKEN }} + tag_name: ${{ needs.preparations.outputs.version }} + name: Pre-Release ${{ needs.preparations.outputs.version }} + body_path: description.txt + draft: false + prerelease: true + build: needs: preparations + strategy: + matrix: + include: + - platform: forge + name: Forge + - platform: fabric + name: Fabric runs-on: ubuntu-latest - steps: - name: Check Environment Variables run: env @@ -56,35 +91,31 @@ jobs: java-version: 17 - name: Make Gradle Wrapper Executable - if: ${{ runner.os != 'Windows' }} run: chmod +x ./gradlew - name: Build run: ./gradlew -Pversion="${{ needs.preparations.outputs.version }}" clean blockAndItemCodeGen build - name: Publish (CurseForge/Modrinth/GitHub) - uses: Kir-Antipov/mc-publish@v3.2 + uses: Kir-Antipov/mc-publish@v3.3 with: loaders: | - fabric - forge + ${{ matrix.platform }} curseforge-id: 935081 curseforge-token: "${{ secrets.CURSEFORGE_TOKEN }}" modrinth-id: usDxEvVr modrinth-token: "${{ secrets.MODRINTH_TOKEN }}" + modrinth-unfeature-mode: loader-any github-tag: "${{ needs.preparations.outputs.version }}" github-token: "${{ secrets.GITHUB_TOKEN }}" - github-prerelease: true - name: "AddEmAll ${{ needs.preparations.outputs.version }} for Minecraft 1.19.2" - version: "${{ needs.preparations.outputs.version }}" - changelog-file: CHANGELOG.md + name: "AddEmAll ${{ matrix.name }} ${{ needs.preparations.outputs.version }} for Minecraft 1.19.2" game-versions: "${{ env.MINECRAFT_VERSION }}" java: "${{ env.JAVA_VERSION }}" files: | - +(Forge|Fabric)/build/libs/*[0-9].jar \ No newline at end of file + ${{ matrix.name }}/build/libs/*[0-9].jar diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0a058b1..b06d312 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Publish on GitHub, CurseForge & Modrinth +name: Publish release on GitHub, CurseForge & Modrinth on: push: @@ -8,9 +8,8 @@ on: env: MINECRAFT_VERSION: 1.19.2 JAVA_VERSION: 17 - MODRINTH_TOKEN: ${{ secrets.PUBLISH_MODRINTH_TOKEN }} - CURSEFORGE_TOKEN: ${{ secrets.PUBLISH_CURSEFORGE_TOKEN }} - GITHUB_TOKEN: ${{ secrets.PUBLISH_GITHUB_TOKEN }} + GITLAB_URL: https://git.griefed.de + GITLAB_PROJECT_ID: 119 permissions: contents: write @@ -34,10 +33,45 @@ jobs: - name: Use tag run: echo ${{steps.tag.outputs.tag}} + + # GET RELEASE INFO + - name: Get Release Info + run: | + curl --header \ + 'PRIVATE-TOKEN: ${{ secrets.GITLAB_TOKEN }}' \ + '${{ env.GITLAB_URL }}/api/v4/projects/${{ env.GITLAB_PROJECT_ID }}/releases/${{ needs.preparations.outputs.version }}' >> version.json + + # GET DESCRIPTION + - name: Extract version changelog + uses: sergeysova/jq-action@v2.3.0 + id: description + with: + cmd: "jq .description version.json -r | sed -e 's/\\n/\\n/g' > description.txt" + multiline: true + + - name: Dafuq # Otherwise we wouldn't be able to work with the file. Because reasons... + run: sudo chown $USER description.txt + + - name: Create Release + id: create_release + uses: softprops/action-gh-release@v0.1.15 + with: + token: ${{ secrets.GITHUB_TOKEN }} + tag_name: ${{ needs.preparations.outputs.version }} + name: Pre-Release ${{ needs.preparations.outputs.version }} + body_path: description.txt + draft: false + build: needs: preparations + strategy: + matrix: + include: + - platform: forge + name: Forge + - platform: fabric + name: Fabric runs-on: ubuntu-latest - steps: - name: Check Environment Variables run: env @@ -54,34 +88,31 @@ jobs: java-version: 17 - name: Make Gradle Wrapper Executable - if: ${{ runner.os != 'Windows' }} run: chmod +x ./gradlew - name: Build run: ./gradlew -Pversion="${{ needs.preparations.outputs.version }}" clean blockAndItemCodeGen build - name: Publish (CurseForge/Modrinth/GitHub) - uses: Kir-Antipov/mc-publish@v3.2 + uses: Kir-Antipov/mc-publish@v3.3 with: loaders: | - fabric - forge + ${{ matrix.platform }} curseforge-id: 935081 curseforge-token: "${{ secrets.CURSEFORGE_TOKEN }}" modrinth-id: usDxEvVr modrinth-token: "${{ secrets.MODRINTH_TOKEN }}" + modrinth-unfeature-mode: loader-any github-tag: "${{ needs.preparations.outputs.version }}" github-token: "${{ secrets.GITHUB_TOKEN }}" - name: "AddEmAll ${{ needs.preparations.outputs.version }} for Minecraft 1.19.2" - version: "${{ needs.preparations.outputs.version }}" - changelog-file: CHANGELOG.md + name: "AddEmAll ${{ matrix.name }} ${{ needs.preparations.outputs.version }} for Minecraft 1.19.2" game-versions: "${{ env.MINECRAFT_VERSION }}" java: "${{ env.JAVA_VERSION }}" files: | - +(Forge|Fabric)/build/libs/*[0-9].jar \ No newline at end of file + ${{ matrix.name }}/build/libs/*[0-9].jar