Files
Content-Monorepo/.forgejo/workflows/auto-update.yml
2026-04-19 12:51:03 -06:00

96 lines
2.9 KiB
YAML

name: "Auto Update & Refresh"
on:
workflow_dispatch:
schedule:
- cron: "0 */6 * * *"
jobs:
auto-update:
runs-on: technocality
steps:
- name: Checkout
uses: actions/checkout@v5
with:
token: ${{ secrets.FORGEJO_TOKEN }}
fetch-depth: 1
filter: blob:none
sparse-checkout: |
modpacks
src/actions/updater
- name: Cache Updater Binary
id: cache-updater
uses: actions/cache@v4
with:
path: ./updater-bin
key: updater-v4-${{ runner.os }}-${{ hashFiles('src/actions/updater/**/*.rs', 'src/actions/updater/Cargo.toml', 'src/actions/updater/Cargo.lock') }}
- name: Install Rust
if: steps.cache-updater.outputs.cache-hit != 'true'
uses: https://github.com/dtolnay/rust-toolchain@stable
- name: Rust Cache (Compiler Internals)
if: steps.cache-updater.outputs.cache-hit != 'true'
uses: https://github.com/Swatinem/rust-cache@v2
with:
workspaces: "src/actions/updater -> target"
- name: Build Updater
if: steps.cache-updater.outputs.cache-hit != 'true'
run: |
cargo build --release --manifest-path src/actions/updater/Cargo.toml --bin updater
mkdir -p ./updater-bin
cp src/actions/updater/target/release/updater ./updater-bin/updater
- name: Cache Packwiz Binary
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: https://github.com/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: Cache Packwiz Downloads
uses: actions/cache@v4
with:
path: ~/.cache/packwiz
key: packwiz-cache-${{ runner.os }}-${{ github.run_id }}
restore-keys: |
packwiz-cache-${{ runner.os }}-
- name: Run Updater
id: rust-update
continue-on-error: true
run: |
chmod +x ./updater-bin/updater
./updater-bin/updater
- name: Run Shell Fallback
if: steps.rust-update.outcome == 'failure'
run: |
echo "Rust updater failed, falling back to shell..."
chmod +x ./modpacks/update-refresh.sh
./modpacks/update-refresh.sh
- name: Commit
uses: https://github.com/EndBug/add-and-commit@v9
with:
author_name: forgejo-actions[bot]
author_email: omo50@noreply.nostalgica.net
message: 'actions: auto-update (${{ github.workflow }})'
add: 'modpacks'