This repository has been archived by the owner on Sep 30, 2023. It is now read-only.
Merge pull request #6 from Aninuscsalas/release-please--branches--mai… #4
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: Modpack Release | Pipeline | |
on: | |
push: | |
branches: | |
- main | |
env: | |
pack-file: 'pack.toml' | |
default-release-modrinth: 'true' | |
default-release-curseforge: 'false' | |
jobs: | |
parse-current-modpacks: | |
name: Parse current modpacks to a list | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
outputs: | |
modpack_folders: ${{ steps.list_modpacks.outputs.modpack_folders }} | |
steps: | |
- name: Check Out Git Repository | |
uses: actions/checkout@v4 | |
- name: List Modpacks | |
id: list_modpacks | |
run: | | |
modpackFolders=() | |
for folder in *; do | |
if [ -d "$folder" ]; then | |
if [ -e "$folder/pack.toml" ]; then | |
modpackFolders+=("$folder") | |
fi | |
fi | |
done | |
echo "modpack_folders=$(jq --compact-output --null-input '$ARGS.positional' --args -- "${modpackFolders[@]}")" >> "$GITHUB_OUTPUT" | |
- name: Current detected modpacks | |
run: | | |
echo "::notice ::⚙ Current detected modpacks: ${{ steps.list_modpacks.outputs.modpack_folders }}" | |
release-please: | |
needs: | |
- parse-current-modpacks | |
if: ${{ (needs.parse-current-modpacks.outputs.modpack_folders) != '[]' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
modpack: ${{ fromJson(needs.parse-current-modpacks.outputs.modpack_folders) }} | |
name: Handle Releases | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ${{ matrix.modpack }} | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
# --- Release please | |
- name: Perform Release with Release Please | |
id: release-please | |
uses: google-github-actions/release-please-action@v3 | |
with: | |
monorepo-tags: true | |
path: ${{ matrix.modpack }} | |
release-type: simple | |
package-name: ${{ matrix.modpack }} | |
prerelease: true | |
changelog-types: > | |
[{"type":"feat","section":"★ Features","hidden":false}, | |
{"type":"fix","section":"♻ Bug Fixes","hidden":false}, | |
{"type":"mod","section":"☀ Modpack Changes","hidden":false}, | |
{"type":"update","section":"⚘ Modpack Updates","hidden":false}, | |
{"type":"chore","section":"⛭ Miscellaneous","hidden":true}] | |
- name: Check Out Git Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# --- Bump pack.toml version | |
# Get Latest tag | |
# TODO: Change to release please tag | |
- name: Get Latest tag | |
id: tag | |
uses: WyriHaximus/github-action-get-previous-tag@v1 | |
if: ${{ steps.release-please.outputs.releases_created }} | |
- name: Bump version | |
uses: ./.github/actions/bump-version-pack | |
with: | |
release-tag: ${{ steps.tag.outputs.tag }} | |
modpack: ${{ matrix.modpack }} | |
if: ${{ steps.release-please.outputs.releases_created }} | |
# --- Handle the configs | |
- name: Parse pack file | |
id: parse | |
uses: ./.github/actions/parse | |
with: | |
modpack: ${{ matrix.modpack }} | |
if: ${{ steps.release-please.outputs.releases_created }} | |
- name: Set mod vendors | |
id: set-mod-vendors | |
run: | | |
[[ ! -z "${{ secrets.CURSEFORGE_TOKEN }}" && ! -z "${{ secrets.CURSEFORGE_ID }}" ]] && echo "curseforge=true" >> $GITHUB_OUTPUT || echo "curseforge=false" >> $GITHUB_OUTPUT | |
[[ ! -z "${{ secrets.MODRINTH_TOKEN }}" && ! -z "${{ secrets.MODRINTH_ID }}" ]] && echo "modrinth=true" >> $GITHUB_OUTPUT || echo "modrinth=false" >> $GITHUB_OUTPUT | |
shell: bash | |
if: ${{ steps.release-please.outputs.releases_created }} | |
# --- Build an release | |
- name: Build modpack | |
uses: ./.github/actions/build | |
with: | |
modpack: ${{ matrix.modpack }} | |
release-tag: ${{ steps.tag.outputs.tag }} | |
build-modrinth: ${{ env.default-release-modrinth }} | |
build-curse: ${{ env.default-release-curseforge }} | |
if: ${{ steps.release-please.outputs.releases_created }} | |
- name: Release modpack to vendors | |
uses: ./.github/actions/release | |
with: | |
modpack: ${{ matrix.modpack }} | |
loader: ${{ steps.parse.outputs.loader }} | |
game-version: ${{ steps.parse.outputs.game-version }} | |
upload-modrinth: ${{ steps.set-mod-vendors.outputs.modrinth }} | |
upload-curse: ${{ steps.set-mod-vendors.outputs.curseforge }} | |
MODRINTH_ID: ${{ secrets.MODRINTH_ID }} | |
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} | |
if: | | |
steps.release-please.outputs.releases_created && | |
(steps.set-mod-vendors.outputs.modrinth || steps.set-mod-vendors.outputs.curseforge) |