Change logo #64
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 to Static Repo | |
| on: | |
| # Trigger only on pushes to these specific branches. | |
| # Do NOT add 'pull_request' here. | |
| push: | |
| branches: | |
| - main | |
| - stoppeds-fun-stuff | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Install ffmpeg | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ffmpeg | |
| - name: Copy build config | |
| run: | | |
| cp workflowConfig.json buildtools_config.json | |
| - name: Run Build Script | |
| run: | | |
| chmod +x ./build.sh | |
| ./build.sh | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: eaglercraft-clients | |
| path: out/ | |
| deploy: | |
| needs: build | |
| # STICT CHECK: Only run if it is a PUSH event AND (is main OR is stoppeds-fun-stuff) | |
| # This prevents PRs from ever running this job. | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/stoppeds-fun-stuff') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: eaglercraft-clients | |
| path: out/ | |
| - name: Install Butler | |
| run: | | |
| curl -L -o butler.zip https://broth.itch.ovh/butler/linux-amd64/LATEST/archive/default | |
| unzip butler.zip | |
| chmod +x butler | |
| ./butler -V | |
| env: | |
| PAT: ${{ secrets.PAT }} | |
| - name: Deploy Manually using Git and LFS | |
| run: | | |
| # 1. Configure Git LFS | |
| git lfs install | |
| # 2. Clone the destination repository | |
| echo "Cloning destination repository..." | |
| git clone "https://x-access-token:${{ secrets.PAT }}@github.com/StoppedwummPython/eageag.git" deploy_repo | |
| # 3. Navigate into the cloned repository | |
| cd deploy_repo | |
| # 4. Configure Git user | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| # 5. Logic to determine where to deploy based on the branch name | |
| CURRENT_BRANCH="${{ github.ref_name }}" | |
| if [ "$CURRENT_BRANCH" == "main" ]; then | |
| echo "--- DEPLOYING MAIN TO ROOT ---" | |
| # PRESERVE snapshit and PRESERVE index.html (unless overwritten) | |
| echo "Cleaning specific client folders only..." | |
| rm -rf eaglercraft_js_client eaglercraft_wasm_client | |
| echo "Copying new files to root..." | |
| cp -r ../out/* . | |
| touch .nojekyll | |
| elif [ "$CURRENT_BRANCH" == "stoppeds-fun-stuff" ]; then | |
| echo "--- DEPLOYING TO SNAPSHIT DIRECTORY ---" | |
| # Ensure directory exists | |
| mkdir -p snapshit | |
| # Clean INSIDE snapshit only | |
| rm -rf snapshit/* | |
| # Copy new files into the subdirectory | |
| echo "Copying files to snapshit/..." | |
| cp -r ../out/* snapshit/ | |
| else | |
| # Safety catch: If we somehow got here on a different branch, fail. | |
| echo "Error: Branch $CURRENT_BRANCH is not authorized for deployment." | |
| exit 1 | |
| fi | |
| # 6. Add, commit, and push | |
| echo "Preparing to commit..." | |
| git add . | |
| if git diff --staged --quiet; then | |
| echo "No changes detected. Nothing to commit." | |
| else | |
| echo "Committing changes..." | |
| git commit -m "Deploy from branch $CURRENT_BRANCH | Source: ${{ github.sha }}" | |
| echo "Pushing to remote..." | |
| git push origin main | |
| fi | |
| env: | |
| PAT: ${{ secrets.PAT }} |