1
0
mirror of https://github.com/gilbN/theme.park.git synced 2024-10-02 21:47:12 +02:00
theme.park/.github/workflows/minify-and-deploy.yml

69 lines
2.2 KiB
YAML
Raw Normal View History

2021-09-12 15:36:09 +02:00
name: Minify CSS and deploy to live branch
on:
push:
branches:
- master
2021-10-30 11:39:58 +02:00
- develop
2021-09-12 15:36:09 +02:00
paths-ignore:
- 'docker-mods/**'
- '.vscode/**'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- 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
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
2021-11-01 22:36:41 +01:00
- name: Run themes.py
2021-09-12 15:36:09 +02:00
run: |
python themes.py
- name: Minify CSS
2021-10-30 11:39:58 +02:00
if: ${{ github.ref == 'refs/heads/master' }}
2021-09-12 15:36:09 +02:00
run: |
2021-10-03 19:00:26 +02:00
sudo npm install -g minify@7.2.2
2021-09-12 15:36:09 +02:00
sudo apt-get update
sudo apt-get -y install moreutils
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}"
}
2021-10-30 11:39:58 +02:00
find ./css -type f -iname *base.css | while read fname
2021-09-12 15:36:09 +02:00
do
if [[ "$fname" != *"min."* ]]; then
minify_file $fname
fi
done
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/master' }}
with:
publish_dir: ./
publish_branch: live
2021-10-03 19:00:26 +02:00
github_token: ${{ secrets.GITHUB_TOKEN }}
2022-03-20 21:04:19 +01:00
exclude_assets: ''
2021-11-01 22:36:41 +01:00
- name: Deploy Develop
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/develop' }}
with:
publish_dir: ./
publish_branch: live_develop
github_token: ${{ secrets.GITHUB_TOKEN }}
2022-03-20 21:04:19 +01:00
exclude_assets: ''