Files
Content-Monorepo/.forgejo/workflows/build.yml
2026-04-18 14:35:38 -06:00

94 lines
2.5 KiB
YAML

name: "Build"
on:
push:
branches: ["main"]
paths:
- 'modpacks/**'
- 'datapacks/**'
- 'src/actions/builder/**'
pull_request:
branches: ["main"]
paths:
- 'modpacks/**'
- 'datapacks/**'
- 'src/actions/builder/**'
workflow_dispatch:
jobs:
build:
runs-on: technocality
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 2
filter: blob:none
sparse-checkout: |
modpacks
datapacks
src/actions/builder
- name: Meta
id: meta
run: |
SHORT_SHA=$(git rev-parse --short HEAD)
echo "short_sha=$SHORT_SHA" >> $GITHUB_OUTPUT
- name: Cache Builder Binary
id: cache-builder
uses: actions/cache@v4
with:
path: ./builder-bin
key: builder-v1-${{ runner.os }}-${{ hashFiles('src/actions/builder/**/*.rs', 'src/actions/builder/Cargo.toml', 'src/actions/builder/Cargo.lock') }}
- name: Install Rust
if: steps.cache-builder.outputs.cache-hit != 'true'
uses: dtolnay/rust-toolchain@stable
- name: Rust Cache (Compiler Internals)
if: steps.cache-builder.outputs.cache-hit != 'true'
uses: Swatinem/rust-cache@v2
with:
workspaces: "src/actions/builder -> target"
- name: Build Builder
if: steps.cache-builder.outputs.cache-hit != 'true'
run: |
cargo build --release --manifest-path src/actions/builder/Cargo.toml --bin builder
mkdir -p ./builder-bin
cp src/actions/builder/target/release/builder ./builder-bin/builder
- name: Cache Go Binaries
id: cache-go
uses: actions/cache@v4
with:
path: ~/go/bin
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'
cache: true
- name: Install Packwiz
if: steps.cache-go.outputs.cache-hit != 'true'
run: go install github.com/packwiz/packwiz@latest
- name: Add Go bin to PATH
run: echo "$HOME/go/bin" >> $GITHUB_PATH
- name: Run Build
run: |
chmod +x ./builder-bin/builder
./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/"