Update Cyclops packages #120
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |