add Japanese translations for sorting and filtering options #70
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: Minify JavaScript, CSS, and HTML while Preserving Comments | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'script.user.js' | |
jobs: | |
minify-and-update: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout main branch | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Install dependencies | |
run: | | |
npm install uglify-js -g | |
sudo apt-get install -y sed | |
- name: Minify JavaScript, CSS, and HTML | |
run: | | |
# Extract userscript header | |
sed -n '/==UserScript==/,/==\/UserScript==/p' script.user.js > header.txt | |
# Minify JavaScript (excluding header) and output on a single line | |
sed '1,/==\/UserScript==/d' script.user.js | uglifyjs --compress --mangle --comments '/^!/' --beautify beautify=false,max_line_len=0 > script.min.js | |
# Combine header and minified script | |
cat header.txt script.min.js > script.final.js | |
- name: Update @updateURL | |
run: | | |
sed -i 's|@updateURL.*|@updateURL https://raw.githubusercontent.com/${{ github.repository }}/minified/script.user.js|' script.final.js | |
- name: Create/Update minified branch | |
run: | | |
git config --global user.name 'GitHub Action' | |
git config --global user.email 'action@github.com' | |
git checkout --orphan minified | |
git rm -rf . | |
mv script.final.js script.user.js | |
git add script.user.js | |
git commit -m "Update minified script with preserved header, minified CSS/HTML, and new @updateURL" | |
git push origin minified --force |