ci: recode all workflows

This commit is contained in:
darksaid98 committed 2024-12-04 00:12:07 +01:00
1 parent 87f9de4823
commit 6717ab7211
11 files changed
+160 -640

No files matched your search

-52
View File
@@ -1,52 +0,0 @@
name: 'Bump Release Please Version | Pipeline'
on:
workflow_dispatch:
inputs:
release-tag:
description: 'The release tag to bump the releases to'
required: false
default: '1.0.0'
type: string
modpack:
description: 'Path to the modpack directory'
required: false
default: 'main'
type: string
workflow_call:
inputs:
release-tag:
description: 'The release tag to bump the releases to'
required: false
default: '1.0.0'
type: string
jobs:
set-version:
runs-on: ubuntu-latest
name: Update Version
permissions:
contents: write
steps:
# --- Checkout the repo
- name: Check Out Git Repository
uses: actions/checkout@v4
# --- Get current branch
- name: Get current branch
id: branch
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
# --- Set the new version
# TODO: Change to an pr
- name: Set the New Version
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_options: '--allow-empty'
skip_dirty_check: true
commit_message: |
chore(${{ steps.branch.outputs.branch }}): release ${{ inputs.release-tag }}
Release-As: ${{ inputs.release-tag }}}
-185
View File
@@ -1,185 +0,0 @@
name: Modpack Release | Pipeline
on:
push:
branches:
- main
env:
pack-file: 'pack.toml'
default-release-modrinth: 'true'
default-release-curseforge: 'true'
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:
# -- Checkout repo
- name: Check Out Git Repository
uses: actions/checkout@v4
# --- Parse the modpacks to and list
# This just parses the folders that have pack.toml
- name: List Modpacks
id: list-modpacks
run: |
modpackFolders=()
for folder in *; do
if [ -d "$folder" ]; then
if [ -e "$folder/${{ env.pack-file }}" ]; then
modpackFolders+=("$folder")
fi
fi
done
echo "modpack-folders=$(jq --compact-output --null-input '$ARGS.positional' --args -- "${modpackFolders[@]}")" >> "$GITHUB_OUTPUT"
# --- Print an nice msg about parsing
- 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
# Creates and manages the prs and releases
- name: Perform Release with Release Please
id: release-please
uses: google-github-actions/release-please-action@v4
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}]
# --- Parse version from PR Title when creating PR's
# Had to do this cause like to bump on the release pleae branch
# The tests for the shitty Regex can be found here: https://regexr.com/7lb8e
- name: Parse tag from PR title
uses: actions-ecosystem/action-regex-match@v2
id: version
with:
text: ${{ fromJson(steps.release-please.outputs.pr).title }}
regex: '(?<=\s)(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$'
if: ${{ steps.release-please.outputs.pr != '' }}
# --- Checkout the git repo
# Remembed to do this AFTER release please
- name: Check Out Git Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
# --- Bump version
# Now we should use the parsed release to bump the version on the files on the release please branch
- name: Bump Version
uses: ./.github/actions/bump-pack
with:
release-tag: ${{ steps.version.outputs.match }}
modpack: ${{ matrix.modpack }}
branch: ${{ fromJson(steps.release-please.outputs.pr).headBranchName }}
if: ${{ steps.release-please.outputs.pr != '' }}
# --- Get latest tag
# Should probably be switched to use the release please tag but whatever
- name: Get Latest tag
id: tag
uses: WyriHaximus/github-action-get-previous-tag@v1
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 }}
# --- Release
- name: Release Modpack to Vendors
uses: ./.github/actions/release
with:
modpack: ${{ matrix.modpack }}
release-tag: ${{ steps.tag.outputs.tag }}
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 }}
CURSEFORGE_ID: ${{ secrets.CURSEFORGE_ID }}
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
if: |
steps.release-please.outputs.releases_created &&
(steps.set-mod-vendors.outputs.modrinth || steps.set-mod-vendors.outputs.curseforge)
+119
View File
@@ -0,0 +1,119 @@
name: Create Release
on:
push:
branches:
- 'main'
tags:
- '*.*.*'
workflow_dispatch:
permissions:
contents: write
discussions: write
pull-requests: write
jobs:
release:
name: Create Release
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
if: github.ref_type == 'tag'
steps:
# Checkout repository and include git LFS files
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
lfs: true
# Download files from Git LFS and caches them to reduce bandwidth usage
- name: Cache and pull LFS files
uses: ./.github/actions/lfs
# Install PackWiz
- name: Install packwiz
uses: supplypike/setup-bin@v4
with:
uri: 'https://nightly.link/packwiz/packwiz/workflows/go/main/Linux%2064-bit%20x86.zip'
name: 'packwiz'
version: 'linux'
# Update version fields in modpack configs
- name: Update version field in configs
uses: ./.github/actions/config
with:
version: ${{ github.ref_name }}
# Refresh packwiz files (Client)
- name: Refresh Packwiz Index Client
run: |
packwiz refresh
shell: bash
working-directory: ./main
# Commit and push updated files
- name: Update repository
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: v${{ github.ref_name }}
branch: main
# Package release (Client)
- name: Build CurseForge Client Modpack
run: |
packwiz curseforge export --output Optim-v${{ github.ref_name }}.zip
shell: bash
working-directory: ./main
- name: Build Modrinth Client Modpack
run: |
packwiz modrinth export --output Optim-v${{ github.ref_name }}.mrpack
shell: bash
working-directory: ./main
# Generate changelog
- name: Generate changelog
uses: ardalanamini/auto-changelog@v4
id: changelog
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
commit-types: |
feat: New Features
remove: Removed Features
fix: Bug Fixes
build: Build System & Dependencies
perf: Performance Improvements
docs: Documentation
test: Tests
refactor: Refactors
chore: Chores
ci: CI
style: Code Style
revert: Reverts
default-commit-type: Other Changes
release-name: ${{ github.ref_name }}
mention-authors: false
mention-new-contributors: false
include-compare-link: false
include-pr-links: false
include-commit-links: false
semver: true
use-github-autolink: true
# Create release
- name: Create Release Client
uses: softprops/action-gh-release@v2
with:
files: |
./main/Optim-v${{ github.ref_name }}.zip
./main/Optim-v${{ github.ref_name }}.mrpack
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ github.ref_name }}
draft: true
prerelease: false
generate_release_notes: false
body: ${{ steps.changelog.outputs.changelog }}
-86
View File
@@ -1,86 +0,0 @@
name: Update | Pipeline
on:
workflow_dispatch:
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 }}"
update_mods:
name: Update Mods
runs-on: ubuntu-latest
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) }}
defaults:
run:
working-directory: ${{ matrix.modpack }}
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install Packwiz
uses: supplypike/setup-bin@v4
with:
uri: 'https://nightly.link/packwiz/packwiz/workflows/go/main/Linux%2064-bit%20x86.zip'
name: 'packwiz'
version: 'linux'
- name: Update Mods with Packwiz
run: packwiz update -a -y
- name: Push the updated mod list via a Pull Request
uses: peter-evans/create-pull-request@v6
with:
commit-message: "update(${{ matrix.modpack }}): updated mods"
title: 'update(${{ matrix.modpack }}): updated mods'
body: >
This PR is auto-generated by
[create-pull-request](https://github.com/peter-evans/create-pull-request).