Skip to content

Update Mods

Update Mods #84

Workflow file for this run

name: Update Mods
on:
workflow_dispatch:
schedule:
# look every friday if there is a update
- cron: '0 0 * * Fri'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.MODPACK_TOKEN }}
fetch-depth: 2
- name: Set up Go
uses: actions/setup-go@v4
- name: Install packwiz
run: go install github.com/packwiz/packwiz@latest
- name: Update mods
run: |
cd packwiz
go run github.com/packwiz/packwiz@latest update --all -y
cd ..
- name: Commit files and push it
run: |
git config --local user.name ${{ secrets.ACTION_USERNAME }}
git config --local user.email ${{ secrets.ACTION_EMAIL }}
git fetch --prune --unshallow --tags
if ! git diff --exit-code $(git tag --sort version:refname | grep -v 'v[0-9]' | tail -n 1) -- packwiz/mods; then
git add .
git --no-pager diff --unified=0 $(git tag --sort version:refname | grep -v 'v[0-9]' | tail -n 1) -- packwiz/mods | grep -w "name" | python updateChangelog.py
VERSION=$(grep -oP '(?<=# Release )\d+\.\d+\.\d+' CHANGELOG.md | head -n 1)
sed -i "s/version = \".*\"/version = \"$VERSION\"/" packwiz/pack.toml
git add .
git commit -m "update mods"
git push
curl -X POST -H "Authorization:Bearer ${{secrets.MODPACK_TOKEN}}" -H "X-GitHub-Api-Version:2022-11-28" https://api.github.com/repos/SkyblockerMod/Skyblocker-modpack/actions/workflows/packwiz-export.yml/dispatches --data '{"ref":"main"}'
fi