Files
Content-Monorepo/.github/workflows/simply-legacy-builds.yml
2025-11-28 23:30:43 -06:00

106 lines
3.4 KiB
YAML

name: Simply Legacy Builds
on:
push:
branches: [ "main" ]
paths:
- 'versions/vanilla/src/simply-legacy/modrinth/**'
pull_request:
branches: [ "main" ]
paths:
- 'versions/vanilla/src/simply-legacy/modrinth/**'
workflow_dispatch:
jobs:
build:
strategy:
matrix:
include:
# modrinth
- version: "1.21.10"
loader: "fabric"
platform: "modrinth"
file_ext: "mrpack"
runs-on: ubuntu-latest
outputs:
commit_sha: ${{ steps.vars.outputs.commit_sha }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACK_NAME: Simply-Legacy
OUTPUT: artifacts
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
# Cache Packwiz binary to avoid Go setup and compilation
- name: Cache Packwiz Binary
uses: actions/cache@v4
id: cache-packwiz
with:
path: ~/go/bin/packwiz
key: packwiz-binary-${{ runner.os }}-v1
restore-keys: |
packwiz-binary-${{ runner.os }}-
# Only set up Go and install Packwiz if not cached
- name: Set up Go
if: steps.cache-packwiz.outputs.cache-hit != 'true'
uses: actions/setup-go@v5
with:
go-version: 'stable'
cache: false
- name: Install Packwiz
if: steps.cache-packwiz.outputs.cache-hit != 'true'
run: go install github.com/packwiz/packwiz@latest
# Add Packwiz to PATH (whether cached or freshly installed)
- name: Add Packwiz to PATH
run: echo "$HOME/go/bin" >> $GITHUB_PATH
- name: Create short commit SHA
id: vars
run: |
shortSha=$(git rev-parse --short ${{ github.sha }})
echo "COMMIT_SHORT_SHA=$shortSha" >> $GITHUB_ENV
echo "commit_sha=$shortSha" >> $GITHUB_OUTPUT
- name: Build ${{ matrix.version }}-${{ matrix.loader }}-${{ matrix.platform }}
run: |
mkdir Simply-${{ matrix.platform }}-${{ matrix.loader }}-${{ matrix.version }}-temp
cp -r ./versions/vanilla/src/simply-legacy/${{ matrix.platform }}/${{ matrix.loader }}/${{ matrix.version }}/* ./Simply-${{ matrix.platform }}-${{ matrix.loader }}-${{ matrix.version }}-temp/
cd ./Simply-${{ matrix.platform }}-${{ matrix.loader }}-${{ matrix.version }}-temp/
packwiz refresh
mkdir -p ../$OUTPUT
packwiz ${{ matrix.platform }} export --output ../${OUTPUT}/${PACK_NAME}-${{ matrix.version }}-${{ matrix.loader }}-dev-${{ matrix.platform }}-${{ env.COMMIT_SHORT_SHA }}.${{ matrix.file_ext }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: "Simply-Legacy-${{ matrix.version }}-${{ matrix.loader }}-${{ matrix.platform }}-dev-${{ env.COMMIT_SHORT_SHA }}"
path: artifacts
combine:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: downloaded-artifacts
- name: Combine artifacts
run: |
mkdir combined-artifacts
find downloaded-artifacts -name "*.mrpack" -exec cp {} combined-artifacts/ \;
find downloaded-artifacts -name "*.zip" -exec cp {} combined-artifacts/ \;
- name: Upload combined artifacts
uses: actions/upload-artifact@v4
with:
name: "Simply-Legacy-dev-${{ needs.build.outputs.commit_sha }}"
path: combined-artifacts