2021-07-25 22:52:44 +02:00
|
|
|
name: Minify CSS and deploy to live branch
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
2021-08-01 17:24:44 +02:00
|
|
|
paths-ignore:
|
|
|
|
- 'docker-mods/**'
|
2021-08-01 17:26:24 +02:00
|
|
|
- '.github/**'
|
|
|
|
- '.vscode/**'
|
2021-07-25 22:52:44 +02:00
|
|
|
jobs:
|
|
|
|
deploy:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2021-07-27 17:28:52 +02:00
|
|
|
- name: Wrong domain check
|
|
|
|
run: |
|
|
|
|
echo "$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }})"
|
|
|
|
if git grep -q -E ${{ secrets.DOMAIN }} -- *.css; then
|
|
|
|
echo "Game over man!"
|
|
|
|
exit 1
|
|
|
|
fi
|
2021-07-28 22:42:55 +02:00
|
|
|
- name: Minify CSS
|
|
|
|
run: |
|
|
|
|
sudo npm install -g minify
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get -y install moreutils
|
2021-07-25 22:52:44 +02:00
|
|
|
|
2021-07-28 22:42:55 +02:00
|
|
|
minify_file(){
|
|
|
|
directory=$1
|
|
|
|
basename=$(basename $directory);
|
|
|
|
extension="${basename##*.}"
|
|
|
|
output="${directory%/*}/"
|
|
|
|
filename="${basename%.*}"
|
|
|
|
output_path="${output}${filename}.${extension}"
|
|
|
|
minify ${directory} | sponge ${output_path}
|
|
|
|
echo "Minified ${directory} > ${output_path}"
|
|
|
|
}
|
|
|
|
|
|
|
|
find ./CSS -type f -iname *base.css | while read fname
|
|
|
|
do
|
|
|
|
if [[ "$fname" != *"min."* ]]; then
|
|
|
|
minify_file $fname
|
|
|
|
fi
|
|
|
|
done
|
2021-08-16 01:30:43 +02:00
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
|
|
uses: actions/setup-python@v2
|
2021-08-20 13:54:17 +02:00
|
|
|
- name: create themes.json
|
|
|
|
run: python themes.py
|
2021-07-25 22:52:44 +02:00
|
|
|
- name: Deploy
|
|
|
|
uses: peaceiris/actions-gh-pages@v3
|
|
|
|
if: ${{ github.ref == 'refs/heads/master' }}
|
|
|
|
with:
|
|
|
|
publish_dir: ./
|
|
|
|
publish_branch: live
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|