update version to 1.1.3 #5
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: Minify Userscript | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| Minify: | |
| name: Minify userscript | |
| permissions: | |
| contents: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 | |
| - name: Install Node.js | |
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5 | |
| with: | |
| node-version-file: ".node-version" | |
| - name: Minify | |
| run: | | |
| echo "Minifying userscript..." | |
| sed -n '/\/\/ ==UserScript==/,/\/\/ ==\/UserScript==/p' "dist/Hagezi to NextDNS.user.js" > "meta.js" | |
| sed -n '/\/\/ ==\/UserScript==/,$p' "dist/Hagezi to NextDNS.user.js" | tail -n +2 > "input.js" | |
| npx terser --compress --mangle --comments false --parse bare_returns --output "output.js" -- "input.js" | |
| [ $(wc -c < "output.js") -lt 100 ] && { echo "Failed to minify userscript"; exit 1; } | |
| cat "meta.js" "output.js" > "dist/Hagezi to NextDNS.min.user.js" | |
| echo "Userscript minification completed!" | |
| - name: Commit | |
| uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0 # v6.0.1 | |
| with: | |
| branch: main | |
| file_pattern: "dist/*.min.user.js" | |
| commit_message: minify userscript |