Skip to content

feat: Add Modrinth release workflow and update README with pack details #27

feat: Add Modrinth release workflow and update README with pack details

feat: Add Modrinth release workflow and update README with pack details #27

Workflow file for this run

# Copyright (c) 2022 Joshua Schmitt
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
name: "🍺 Release Build"
on:
push:
tags:
- 'v*'
jobs:
getinfo:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.version.outputs.tag }}
name: "πŸ“™ Modpack Info"
steps:
- name: "πŸ” Checkout"
uses: actions/checkout@v4
- name: "πŸ“› Get tag"
id: version
uses: "WyriHaximus/github-action-get-previous-tag@v1"
changelog:
runs-on: ubuntu-latest
name: "πŸ“œ Changelog"
outputs:
changelog: ${{steps.changelog.outputs.changelog}}
steps:
- name: "πŸ” Checkout"
uses: actions/checkout@v4
- name: "πŸ—’οΈ Build Changelog"
id: changelog
uses: mikepenz/release-changelog-builder-action@v4
env:
GITHUB_TOKEN: ${{ secrets.PROFILE_TOKEN }}
build:
name: 🐐 Build
runs-on: ubuntu-latest
strategy:
matrix:
version: [1.16, 1.17, 1.18, 1.19, "1.20", 1.21]
include:
- version: 1.16
pack_version: 6
latest: false
- version: 1.17
pack_version: 7
latest: false
- version: 1.18
pack_version: 8
latest: false
- version: 1.19
pack_version: 13
latest: false
- version: 1.20
pack_version: 32
latest: false
- version: 1.21
pack_version: 46
latest: true
steps:
- name: πŸ” Checkout
if: ${{ matrix.latest == false }}
uses: actions/checkout@v4
with:
ref: 'ver/${{ matrix.version }}'
- name: πŸ” Checkout
if: ${{ matrix.latest == true }}
uses: actions/checkout@v4
- name: πŸ’Ύ Update config.json
run: echo "`jq '.pack.pack_format=${{ matrix.pack_version }}' pack.mcmeta`" > pack.mcmeta
- name: πŸ“¦ ZIP
uses: vimtor/action-zip@v1
with:
files: assets/ pack.mcmeta pack.png credits.md
dest: pack.zip
- name: 🏹 Upload
uses: actions/upload-artifact@v3
with:
name: JqshuvPack-${{ matrix.version }}.X
path: |
assets/
pack.mcmeta
pack.png
credits.md
# zip_build:
# name: "πŸ“­ Build ZIP Release"
# needs: [build]
# runs-on: ubuntu-latest
# strategy:
# matrix:
# version: [1.16, 1.17, 1.18, 1.19, "1.20", 1.21]
# steps:
# - name: "πŸ”½ Download Packs"
# uses: actions/download-artifact@v3
# with:
# name: JqshuvPack-${{ matrix.version }}.X
# - name: πŸ“¦ ZIP
# run: zip -r JqshuvPack-${{ matrix.version }}.X.zip *
# - name: 🏹 Upload
# uses: actions/upload-artifact@v3
# with:
# name: packs
# path: JqshuvPack-${{ matrix.version }}.X.zip
release-github:
runs-on: ubuntu-latest
needs: [build, changelog, getinfo]
name: "πŸ™ Release to Github"
strategy:
matrix:
version: [1.16, 1.17, 1.18, 1.19, "1.20", 1.21]
steps:
- name: "πŸ”½ Download Packs"
uses: actions/download-artifact@v3
with:
name: JqshuvPack-${{ matrix.version }}.X
- name: πŸ“¦ ZIP
run: zip -r JqshuvPack-${{ matrix.version }}.X.zip *
- name: "🐍 Get release type"
id: release-type
run: |
rel_type="release"
case "${{ needs.getinfo.outputs.tag }}" in
*alpha*) rel_type="true" ;;
*beta*) rel_type="true" ;;
*rc**) rel_type="true" ;;
*) rel_type="false" ;;
esac
echo "::set-output name=type::$rel_type"
- name: "🧬 Create release"
uses: svenstaro/upload-release-action@v2
with:
body: ${{ steps.changelog.outputs.changelog }}
prerelease: ${{ steps.release-type.outputs.type }}
file: JqshuvPack-${{ matrix.version }}.X.zip
release-modrinth:
runs-on: ubuntu-latest
needs: [build, changelog, getinfo]
name: "🐲 Release to Modrinth"
strategy:
matrix:
version: [1.16, 1.17, 1.18, 1.19, "1.20", 1.21]
steps:
- name: "πŸ”½ Download Packs"
uses: actions/download-artifact@v3
with:
name: JqshuvPack-${{ matrix.version }}.X
- name: πŸ“¦ ZIP
run: zip -r JqshuvPack-${{ matrix.version }}.X.zip *
- name: "🐍 Get release type"
id: release-type
run: |
rel_type="release"
case "${{ needs.getinfo.outputs.tag }}" in
*alpha*) rel_type="alpha" ;;
*beta*) rel_type="beta" ;;
*rc**) rel_type="beta" ;;
*) rel_type="false" ;;
esac
echo "::set-output name=type::$rel_type"
- name: "🧬 Create release"
uses: cloudnode-pro/modrinth-publish@2.0.0
with:
project: r4SmPOJL
name: ${{ needs.getinfo.outputs.tag }}
changelog: ${{ steps.changelog.outputs.changelog }}
version: ${{ needs.getinfo.outputs.tag }}
token: ${{ secrets.MODRINTH_TOKEN }}
game-versions: ${{ matrix.version }}
channel: ${{ steps.release-type.outputs.type }}
files: JqshuvPack-${{ matrix.version }}.X.zip
loaders: minecraft