chore(deps-dev): bump mocha from 10.7.3 to 11.1.0 #35
This file contains 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: 🚀 Haxball.JS CI/CD | |
on: | |
schedule: | |
- cron: '0 0 * * 0' # Run at 00:00 on Sunday | |
workflow_dispatch: # Allow manual triggers | |
push: | |
branches: [main] | |
paths: | |
- 'scripts/nodeify.js' | |
- 'package.json' | |
- 'package-lock.json' | |
pull_request: | |
branches: [main] | |
paths: | |
- 'scripts/nodeify.js' | |
- 'package.json' | |
- 'package-lock.json' | |
jobs: | |
build: | |
name: 🛠️ Build Source | |
runs-on: ubuntu-latest | |
outputs: | |
hash: ${{ steps.nodeify.outputs.hash }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: 📦 Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 22.x | |
cache: 'npm' | |
- name: 📥 Install Dependencies | |
run: npm ci | |
- name: 🔨 Build Source Code | |
id: nodeify | |
run: | | |
OUTPUT=$(npm run build) | |
if [[ $OUTPUT =~ SUCCESS:([a-zA-Z0-9]+) ]]; then | |
HASH="${BASH_REMATCH[1]}" | |
echo "hash=$HASH" >> $GITHUB_OUTPUT | |
echo "🎉 Build successful with hash: $HASH" | |
else | |
echo "❌ Build failed: $OUTPUT" | |
exit 1 | |
fi | |
- name: 📤 Upload Build Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: haxball-build | |
path: src/build.js | |
retention-days: 7 | |
test: | |
needs: build | |
name: 🧪 Test (${{ matrix.os }}, Node ${{ matrix.node-version }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
node-version: [18.x, 22.x] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
- name: 📦 Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: 📥 Download Build | |
uses: actions/download-artifact@v3 | |
with: | |
name: haxball-build | |
path: src | |
- name: 📥 Install Dependencies | |
run: npm ci | |
- name: 🧪 Run Core Tests | |
run: npm test | |
env: | |
CI_HB_HEADLESS_TOKEN: ${{ secrets.HEADLESS_TEST_TOKEN }} | |
- name: 🌐 Run Proxy Tests (Optional) | |
if: always() | |
continue-on-error: true | |
run: npm test | |
env: | |
CI_HB_PROXY: '1' | |
CI_HB_HEADLESS_TOKEN: ${{ secrets.HEADLESS_TEST_TOKEN }} | |
publish: | |
needs: [build, test] | |
name: 📢 Publish Build | |
if: github.event_name != 'pull_request' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: 📥 Download Build | |
uses: actions/download-artifact@v3 | |
with: | |
name: haxball-build | |
path: src | |
- name: 🔄 Prepare Build | |
run: | | |
mv src/build.js src/index.js | |
echo "✨ Build prepared for publishing" | |
- name: 🚀 Create Pull Request | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
BRANCH_NAME="bot/update-haxball-$(date +%Y%m%d-%H%M%S)" | |
git checkout -b "$BRANCH_NAME" | |
if [[ -n "$(git status --porcelain)" ]]; then | |
git add src/index.js | |
git commit -m "🤖 Update Haxball Headless (Build: ${{ needs.build.outputs.hash }})" | |
git push origin "$BRANCH_NAME" | |
gh pr create \ | |
--title "🤖 Update Haxball Headless (Build: ${{ needs.build.outputs.hash }})" \ | |
--body "🔄 Auto-generated by GitHub Actions | |
🏷️ Build Hash: ${{ needs.build.outputs.hash }} | |
⚡ Includes latest Haxball Headless updates" \ | |
--base main \ | |
--head "$BRANCH_NAME" | |
else | |
echo "📝 No changes to commit, build is up-to-date. 💫" | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |