Bug fixes. #155
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 Worker | |
on: | |
push: | |
branches: | |
- dev | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "latest" | |
- name: Install dependencies | |
run: npm install | |
- name: Build project | |
run: npx wrangler deploy src/worker.js --name bpb-worker-panel --compatibility-flag [nodejs_compat] --compatibility-date 2025-01-18 --dry-run --minify --outdir=dist | |
- name: Minify JS | |
run: npx terser dist/worker.js --output dist/_worker.js --comments false | |
- name: Organize build files | |
run: | | |
mkdir -p build | |
cp -f dist/_worker.js build/unobfuscated-worker.js | |
zip -j build/unobfuscated-worker.zip dist/_worker.js | |
- name: Obfuscate JS | |
run: | | |
npx javascript-obfuscator --config ./obfs-config.json dist/_worker.js --output _worker.js | |
cp -f _worker.js build/worker.js | |
zip -j build/worker.zip _worker.js | |
- name: Commit and push built worker | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git add _worker.js | |
git add -f build/ | |
git commit -m "Automated build: update _worker.js" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |