Repository navigation
Update dependency org.cyclops.evilcraft:evilcraft-1.21.1-neoforge to … #132
Workflow file for this run
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@v7 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Java ☕ | |
| uses: actions/setup-java@v6 | |
| with: | |
| java-version: 21 | |
| distribution: temurin | |
| - name: Setup Node.js 🟢 | |
| uses: actions/setup-node@v7 | |
| with: | |
| node-version: 24 | |
| - name: Cache Minecraft server files 💾 | |
| uses: actions/cache@v6 | |
| 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 icons version 🔄 | |
| run: | | |
| # Bump this whenever the icon rendering changes, e.g. after an IconExporter update that | |
| # changes how icons look, so that the icons that are already deployed on gh-pages are | |
| # replaced by freshly rendered ones instead of being restored over them. | |
| ICONS_REVISION=1 | |
| # Read the current Minecraft version from modpack.json | |
| MC_VERSION=$(python3 -c "import json; print(json.load(open('modpack.json'))['minecraft'])") | |
| ICONS_VERSION="${MC_VERSION} icons-r${ICONS_REVISION}" | |
| echo "Current icons version: $ICONS_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 icons version: '${PREV_VERSION}'" | |
| if [ "$ICONS_VERSION" = "$PREV_VERSION" ]; then | |
| echo "Icons 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 "Icons version changed from '${PREV_VERSION}' to '${ICONS_VERSION}' — using all freshly generated icons" | |
| fi | |
| # Write the current icons version into output/ so it is tracked on gh-pages | |
| # and future deployments can detect whether the icons have to be re-rendered. | |
| echo "$ICONS_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.9.0 | |
| with: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| BRANCH: gh-pages | |
| FOLDER: output | |
| CLEAN: true |