mirror of
https://github.com/darksaid98/optim.git
synced 2026-12-01 14:38:49 +00:00
ci: recode all workflows
This commit is contained in:
11 files changed
+160
-640
No files matched your search
@@ -1,84 +0,0 @@
|
||||
name: 'Build Modpack Action | Action'
|
||||
description: 'Uses packwiz to build the modpack!'
|
||||
inputs:
|
||||
release-tag:
|
||||
description: "The release tag for the modpack upload"
|
||||
required: true
|
||||
build-modrinth:
|
||||
description: "Set to 'true' to build the Modrinth .mrpack file"
|
||||
required: true
|
||||
build-curse:
|
||||
description: "Set to 'true' to build the CurseForge .zip file"
|
||||
required: true
|
||||
modpack:
|
||||
description: "Path to the modpack directory"
|
||||
required: false
|
||||
default: '.'
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
|
||||
steps:
|
||||
|
||||
# --- Checkout the repo
|
||||
- name: Check Out Git Repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: 'main'
|
||||
|
||||
|
||||
# --- Install Packwiz
|
||||
- name: Install packwiz
|
||||
uses: supplypike/setup-bin@v3
|
||||
with:
|
||||
uri: "https://nightly.link/packwiz/packwiz/workflows/go/main/Linux%2064-bit%20x86.zip"
|
||||
name: "packwiz"
|
||||
version: "linux"
|
||||
|
||||
|
||||
# --- Build Modrinth Pack If Wanted
|
||||
- name: Build Modrinth Modpack
|
||||
if: inputs.build-modrinth == 'true'
|
||||
run: |
|
||||
packwiz modrinth export
|
||||
echo "::notice ::⚙ Modpack ${{ inputs.modpack }} has been exported as .mrpack"
|
||||
shell: bash
|
||||
working-directory: ${{ inputs.modpack }}
|
||||
|
||||
|
||||
# --- Build Curseforge Pack If Wanted
|
||||
- name: Build CurseForge Modpack
|
||||
if: inputs.build-curse == 'true'
|
||||
run: |
|
||||
packwiz curseforge export
|
||||
echo "::notice ::⚙ Modpack ${{ inputs.modpack }} has been exported as .zip"
|
||||
shell: bash
|
||||
working-directory: ${{ inputs.modpack }}
|
||||
|
||||
|
||||
# --- Upload the pack/s to releases
|
||||
|
||||
- name: Upload Modrinth Modpack to GitHub Releases
|
||||
if: inputs.build-modrinth == 'true'
|
||||
run: |
|
||||
gh release upload ${{ inputs.release-tag }} *.mrpack \
|
||||
--repo ${{ github.repository_owner }}/${{ github.event.repository.name }} \
|
||||
--clobber
|
||||
echo "::notice ::☀ Modpack ${{ inputs.modpack }} has been uploaded to GitHub Releases as a .mrpack"
|
||||
shell: bash
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
working-directory: ${{ inputs.modpack }}
|
||||
|
||||
- name: Upload CurseForge Modpack to GitHub Releases
|
||||
if: inputs.build-curse == 'true'
|
||||
run: |
|
||||
gh release upload ${{ inputs.release-tag }} *.zip \
|
||||
--repo ${{ github.repository_owner }}/${{ github.event.repository.name }} \
|
||||
--clobber
|
||||
echo "::notice ::☀ Modpack ${{ inputs.modpack }} has been uploaded to GitHub Releases as a .zip"
|
||||
shell: bash
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
working-directory: ${{ inputs.modpack }}
|
||||
@@ -1,43 +0,0 @@
|
||||
name: 'Bump Modpack Action | Action'
|
||||
description: 'Bump a modpacks version'
|
||||
|
||||
inputs:
|
||||
release-tag:
|
||||
description: 'The release tag to bump the modpack to'
|
||||
required: true
|
||||
modpack:
|
||||
description: 'Path to the modpack directory'
|
||||
required: false
|
||||
default: '.'
|
||||
pack-file:
|
||||
description: 'Path to the pack config file'
|
||||
required: false
|
||||
default: 'pack.toml'
|
||||
branch:
|
||||
description: "Branch, where to do the bump"
|
||||
required: false
|
||||
default: 'main'
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
|
||||
steps:
|
||||
|
||||
# --- Checkout with the named branch
|
||||
- name: Check Out Git Repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ inputs.branch }}
|
||||
|
||||
|
||||
# --- Use sed to set the version
|
||||
- name: Set the Version
|
||||
run: sed -i 's/version = "[^"]*"/version = "${{ inputs.release-tag }}"/' ${{ inputs.modpack }}/${{ inputs.pack-file }}
|
||||
shell: bash
|
||||
|
||||
|
||||
# --- Push the version
|
||||
- name: Push The Updated Version
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: "chore(${{ inputs.modpack }}): bump version to ${{ inputs.release-tag }}"
|
||||
@@ -0,0 +1,19 @@
|
||||
name: 'Update config version fields'
|
||||
description: 'Sets the version fields in all relevant modpack config files'
|
||||
|
||||
inputs:
|
||||
version:
|
||||
description: 'Modpack version'
|
||||
required: true
|
||||
default: '1.0.0'
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
# Update version fields for client pack
|
||||
- name: Update client versions
|
||||
uses: colathro/[email protected]
|
||||
with:
|
||||
file: "./main/pack.toml"
|
||||
key: "version"
|
||||
value: "client-beta-v${{ inputs.version }}"
|
||||
@@ -0,0 +1,22 @@
|
||||
name: 'Cache LFS files'
|
||||
description: 'Downloads and caches all git LFS files.'
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: LFS Create File List
|
||||
run: git lfs ls-files --long | cut -d ' ' -f1 | sort > .lfs-assets-id
|
||||
shell: bash
|
||||
|
||||
- name: LFS Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: .git/lfs/objects
|
||||
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-lfs-
|
||||
|
||||
- name: LFS Pull
|
||||
run: git lfs pull
|
||||
shell: bash
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
name: 'Parse Modpack | Action'
|
||||
description: 'Parses a modpacks pack file'
|
||||
|
||||
inputs:
|
||||
modpack:
|
||||
description: 'Path to the modpack directory'
|
||||
required: false
|
||||
default: '.'
|
||||
pack-file:
|
||||
description: 'Path to the pack config file'
|
||||
required: false
|
||||
default: 'pack.toml'
|
||||
|
||||
outputs:
|
||||
loader:
|
||||
description: 'Detected mod loader'
|
||||
value: ${{ steps.parse.outputs.loader }}
|
||||
game-version:
|
||||
description: 'Detected game version'
|
||||
value: ${{ steps.parse.outputs.game-version }}
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
|
||||
steps:
|
||||
|
||||
# --- Checkout repo
|
||||
- name: Check Out Git Repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
|
||||
# --- Parse the pack.toml
|
||||
# I am bored so sorry that I don't explain this, you should probably read the code?
|
||||
- name: Parse the pack.toml
|
||||
id: parse
|
||||
run: |
|
||||
loaders=("fabric" "forge" "quilt" "neoforge")
|
||||
for loader in "${loaders[@]}"; do
|
||||
if [[ $(<"${{ inputs.pack-file }}") == *"$loader ="* ]]; then
|
||||
LOADER="$loader" && break
|
||||
fi
|
||||
done
|
||||
|
||||
[[ -z "$LOADER" ]] && { echo "::error file=${{ inputs.pack-file }}::No match found for loaders in ${{ inputs.pack-file }}" && exit 1; }
|
||||
|
||||
GAME_VERSION=$(grep -oP 'minecraft = "\K[^"]+' "${{ inputs.pack-file }}")
|
||||
echo "loader=$LOADER" >> $GITHUB_ENV
|
||||
echo "game-version=$GAME_VERSION" >> $GITHUB_ENV
|
||||
|
||||
echo "::notice ::⚙ The detected loader for ${{ inputs.modpack }} is $LOADER"
|
||||
echo "::notice ::⚙ The detected game version for ${{ inputs.modpack }} is $GAME_VERSION"
|
||||
shell: bash
|
||||
working-directory: ${{ inputs.modpack }}
|
||||
@@ -1,135 +0,0 @@
|
||||
name: 'Release Modpack From A Release | Action'
|
||||
description: 'This automatically downloads the newest release and description and uploads it to vendors!'
|
||||
inputs:
|
||||
loader:
|
||||
description: "Current Modpack Loader"
|
||||
required: true
|
||||
game-version:
|
||||
description: "Current Modpack Game Version"
|
||||
required: true
|
||||
upload-modrinth:
|
||||
description: "Should the Modpack Be Uploaded to Modrinth"
|
||||
required: true
|
||||
upload-curse:
|
||||
description: "Should the Modpack Be Uploaded to CurseForge"
|
||||
required: true
|
||||
|
||||
MODRINTH_TOKEN:
|
||||
required: false
|
||||
description: "Token used to uploading modpack to Modrinth"
|
||||
MODRINTH_ID:
|
||||
required: false
|
||||
description: "ID used to uploading modpack to Modrinth"
|
||||
CURSEFORGE_TOKEN:
|
||||
required: false
|
||||
description: "Token used to uploading modpack to Curseforge"
|
||||
CURSEFORGE_ID:
|
||||
required: false
|
||||
description: "ID used to uploading modpack to Curseforge"
|
||||
|
||||
modpack:
|
||||
description: "Modpack directory"
|
||||
required: false
|
||||
default: .
|
||||
|
||||
release-tag:
|
||||
description: "Tag for the release"
|
||||
required: true
|
||||
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
|
||||
# --- Checkout the repo
|
||||
- name: Check Out Git Repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# --- Download the pack files
|
||||
- name: Download the pack files
|
||||
uses: robinraju/[email protected]
|
||||
id: download-files
|
||||
with:
|
||||
fileName: "*"
|
||||
tag: ${{ inputs.release-tag }}
|
||||
tarBall: false
|
||||
zipBall: false
|
||||
|
||||
|
||||
# --- Get latest release description
|
||||
- name: Get latest release description
|
||||
uses: cardinalby/git-get-release-action@v1
|
||||
id: latest-release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
with:
|
||||
tag: ${{ inputs.release-tag }}
|
||||
|
||||
|
||||
# --- Set publish version-type
|
||||
- name: Set publish version-type
|
||||
id: release-type
|
||||
run: |
|
||||
if [ "${{ steps.latest-release.outputs.prerelease }}" = "true" ]; then
|
||||
echo "Setting release-type to beta"
|
||||
echo "release-type=beta" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "Setting release-type to release"
|
||||
echo "release-type=release" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
|
||||
# --- Pipe latest release description to file
|
||||
- name: Pipe latest release description to file
|
||||
run: echo "${{ steps.latest-release.outputs.body }}" > CHANGELOG.release.md
|
||||
shell: bash
|
||||
|
||||
|
||||
# --- Print status
|
||||
- name: Print status
|
||||
run: |
|
||||
echo "::notice ::⚙ Assets from latest release ${{ steps.latest-release.outputs.tag_name }} downloaded successfully!"
|
||||
echo "::notice ::⚙ Latest release ${{ steps.latest-release.outputs.tag_name }} description piped into a file successfully!"
|
||||
shell: bash
|
||||
|
||||
|
||||
- name: Publish to Modrinth
|
||||
id: modrinth
|
||||
if: inputs.upload-modrinth == 'true'
|
||||
uses: Kir-Antipov/[email protected]
|
||||
with:
|
||||
modrinth-id: ${{ inputs.MODRINTH_ID }}
|
||||
modrinth-token: ${{ inputs.MODRINTH_TOKEN }}
|
||||
loaders: ${{ env.loader }}
|
||||
game-versions: ${{ env.game-version }}
|
||||
changelog-file: CHANGELOG.release.*
|
||||
files: "*.mrpack"
|
||||
version: ${{ inputs.release-tag }}
|
||||
version-type: ${{ steps.release-type.outputs.release-type }}
|
||||
|
||||
- name: Print Modrinth upload status
|
||||
if: steps.modrinth.outcome == 'success'
|
||||
run: |
|
||||
echo "::notice ::☀ Modpack ${{ inputs.modpack }} has been uploaded to Modrinth with ${{ inputs.MODRINTH_ID }}"
|
||||
shell: bash
|
||||
|
||||
- name: Publish to CurseForge
|
||||
id: curseforge
|
||||
if: inputs.upload-curse == 'true'
|
||||
uses: Kir-Antipov/[email protected]
|
||||
with:
|
||||
curseforge-id: ${{ inputs.CURSEFORGE_ID }}
|
||||
curseforge-token: ${{ inputs.CURSEFORGE_TOKEN }}
|
||||
loaders: ${{ env.loader }}
|
||||
game-versions: ${{ env.game-version }}
|
||||
changelog-file: CHANGELOG.release.*
|
||||
files: "*.zip"
|
||||
version: ${{ inputs.release-tag }}
|
||||
version-type: ${{ steps.release-type.outputs.release-type }}
|
||||
|
||||
- name: Print Curseforge upload status
|
||||
if: steps.curseforge.outcome == 'success'
|
||||
run: |
|
||||
echo "::notice ::☀ Modpack ${{ inputs.modpack }} has been uploaded to Curseforge with ${{ inputs.CURSEFORGE_ID }}"
|
||||
shell: bash
|
||||
Reference in new issue
Block a user