fix(ci): fix the build

This commit is contained in:
omo50
2026-04-18 13:36:22 -06:00
parent 9c3f68ce84
commit 06ad38d237

View File

@@ -2,13 +2,17 @@ name: "Build"
on:
push:
branches: [ "main" ]
branches: ["main"]
paths:
- 'modpacks/**'
- 'resourcepacks/**'
- 'datapacks/**'
- 'src/actions/**'
pull_request:
branches: [ "main" ]
branches: ["main"]
paths:
- 'modpacks/**'
- 'datapacks/**'
- 'src/actions/**'
workflow_dispatch:
jobs:
@@ -22,19 +26,13 @@ jobs:
filter: blob:none
sparse-checkout: |
modpacks
resourcepacks
datapacks
src/actions
- name: Meta
id: meta
run: |
MANIFEST=$(git diff-tree --no-commit-id --name-only -r HEAD | grep 'manifest.json' | head -n 1)
if [ -z "$MANIFEST" ]; then MANIFEST="modpacks/simply-legacy/manifest.json"; fi
SHORT_SHA=$(git rev-parse --short HEAD)
echo "manifest=$MANIFEST" >> $GITHUB_OUTPUT
echo "short_sha=$SHORT_SHA" >> $GITHUB_OUTPUT
- name: Cache Go Binaries
@@ -42,9 +40,10 @@ jobs:
uses: actions/cache@v4
with:
path: ~/go/bin
key: go-bin-v1-${{ runner.os }}
key: go-bin-packwiz-v1-${{ runner.os }}
- name: Setup Go
if: steps.cache-go.outputs.cache-hit != 'true'
uses: actions/setup-go@v5
with:
go-version: 'stable'
@@ -52,10 +51,9 @@ jobs:
- name: Install Packwiz
if: steps.cache-go.outputs.cache-hit != 'true'
run: |
go install github.com/packwiz/packwiz@latest
- name: Add Path
run: go install github.com/packwiz/packwiz@latest
- name: Add Go bin to PATH
run: echo "$HOME/go/bin" >> $GITHUB_PATH
- name: Install Rust
@@ -66,9 +64,9 @@ jobs:
uses: actions/cache@v4
with:
path: ./builder-bin
key: builder-v1-${{ runner.os }}-${{ hashFiles('src/actions/publish.rs') }}
key: builder-v1-${{ runner.os }}-${{ hashFiles('src/actions/**/*.rs', 'src/actions/Cargo.toml', 'src/actions/Cargo.lock') }}
- name: Rust Cache (Compiler Internals)
- name: Rust Cache
if: steps.cache-builder.outputs.cache-hit != 'true'
uses: Swatinem/rust-cache@v2
with:
@@ -77,17 +75,17 @@ jobs:
- name: Build Builder
if: steps.cache-builder.outputs.cache-hit != 'true'
run: |
cargo build --release --manifest-path src/actions/Cargo.toml --bin publish
cargo build --release --manifest-path src/actions/Cargo.toml --bin builder
mkdir -p ./builder-bin
cp src/actions/target/release/publish ./builder-bin/builder
cp src/actions/target/release/builder ./builder-bin/builder
- name: Run Build
run: |
chmod +x ./builder-bin/builder
./builder-bin/builder "${{ steps.meta.outputs.manifest }}"
./builder-bin/builder "${{ steps.meta.outputs.short_sha }}"
- name: Upload
uses: https://code.forgejo.org/actions/upload-artifact@v3
with:
name: "build-${{ steps.meta.outputs.short_sha }}"
path: "**/artifacts/"
path: "artifacts/"