Skip to content

Update Cyclops packages #120

Update Cyclops packages

Update Cyclops packages #120

Workflow file for this run

name: Build and Deploy
on: [push]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout πŸ›ŽοΈ
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Setup Java β˜•
uses: actions/setup-java@v5
with:
java-version: 21
distribution: temurin
- name: Setup Node.js 🟒
uses: actions/setup-node@v6
with:
node-version: 24
- name: Cache Minecraft server files πŸ’Ύ
uses: actions/cache@v5
with:
path: |
server
headlessmc/game
key: minecraft-${{ hashFiles('modpack.pom.xml') }}
- name: Install and Build πŸ”§
run: |
npm install --legacy-peer-deps
npm run build
npm run lint
- name: Generate modpack.json from POM πŸ“‹
run: npm run generate:modpack
- name: Download mods and generate metadata πŸ“¦
run: npm run generate:metadata
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install Xvfb πŸ–₯️
run: sudo apt-get install -y xvfb
- name: Generate icons 🎨
run: xvfb-run --auto-servernum --server-args="-screen 0 1920x1080x24" npm run generate:icons
- name: Generate HTML πŸ“„
run: npm run generate:html
- name: Compress icons πŸ—œοΈ
run: npm run generate:compress
- name: Restore unchanged icons and track Minecraft version πŸ”„
run: |
# Read the current Minecraft version from modpack.json
MC_VERSION=$(python3 -c "import json; print(json.load(open('modpack.json'))['minecraft'])")
echo "Current Minecraft version: $MC_VERSION"
# Try to fetch gh-pages (may not exist on the very first deployment)
PREV_VERSION=""
if git fetch origin gh-pages --depth=1 2>/dev/null; then
PREV_VERSION=$(git cat-file blob origin/gh-pages:minecraft-version.txt 2>/dev/null || echo "")
fi
echo "Previous Minecraft version: '${PREV_VERSION}'"
if [ "$MC_VERSION" = "$PREV_VERSION" ]; then
echo "Minecraft version unchanged β€” restoring existing icons from gh-pages (only new icons will be added)"
RESTORED=0
SKIPPED=0
while IFS= read -r icon_path; do
local_path="output/$icon_path"
if [ -f "$local_path" ]; then
git cat-file blob "origin/gh-pages:$icon_path" > "$local_path"
RESTORED=$((RESTORED + 1))
else
SKIPPED=$((SKIPPED + 1))
fi
done < <(git ls-tree -r --name-only origin/gh-pages -- 'assets/icon/' 2>/dev/null || true)
echo "Restored $RESTORED existing icons from gh-pages; $SKIPPED icons from gh-pages no longer present in new export"
else
echo "Minecraft version changed from '${PREV_VERSION}' to '${MC_VERSION}' β€” using all freshly generated icons"
fi
# Write the current Minecraft version into output/ so it is tracked on gh-pages
# and future deployments can detect whether the Minecraft version has changed.
echo "$MC_VERSION" > output/minecraft-version.txt
echo "Written output/minecraft-version.txt"
- name: Deploy πŸš€
if: github.ref == 'refs/heads/master'
uses: JamesIves/github-pages-deploy-action@v4.8.0
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: output
CLEAN: true