Merge remote-tracking branch 'origin/main' #68
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: Deploy to gh-pages | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout main branch | |
- uses: actions/checkout@v2 | |
name: Checkout | |
with: | |
fetch-depth: 0 | |
# Setup Node.js and NPM | |
- uses: actions/setup-node@v2 | |
name: Setup Node.js | |
with: | |
node-version: 20 | |
# Install build deps | |
- name: Install build deps | |
run: npm i | |
# Build site | |
- name: Build site | |
run: npm run css-deploy | |
# Build sitemap | |
- name: Build Sitemap | |
uses: cicirello/generate-sitemap@v1 | |
with: | |
base-url-path: https://scripty.org | |
drop-html-extension: true | |
# Shrink CSS | |
- name: Shrink CSS | |
run: node minify.js | |
# Download minifier program and untar it to /tmp | |
- name: Download minifier | |
run: | | |
curl -L https://github.com/tdewolff/minify/releases/download/v2.12.4/minify_linux_amd64.tar.gz | tar xz -C /tmp | |
# # Minify all assets to ./out | |
# Remove the ./out directory if it exists | |
# Iterate over all files in the current directory and minify them to the same path with root in ./out | |
# Ignore hidden files and directories | |
# Copy all remaining files to ./out, ignoring hidden files and directories, and not overwriting existing files | |
- name: Minify | |
run: | | |
shopt -s extglob | |
rm -rf ./out || true; | |
for file in $(find . -type f -not -path '*/\.*'); do | |
/tmp/minify "./$file" -o "./out/$file" || true; | |
done | |
cp -Rn !(out) out/ || true; | |
shell: bash | |
# Publish to gh-pages | |
- name: Publish Site | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.ACCESS_TOKEN }} | |
publish_dir: ./out | |
cname: scripty.org | |
exclude_assets: '.github,node_modules,lib,_sass,_javascript,minify.js,package.json,package-lock.json,README.md' |