Use JamesIves/github-pages-deploy-action #58
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 | |
on: | |
push: | |
branches: | |
- master | |
- main | |
pull_request: | |
branches: | |
- master | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: write | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.3.5' | |
bundler-cache: true | |
- name: Install dependencies and build | |
run: | | |
npm install -g @mermaid-js/mermaid-cli | |
sudo apt-get update && sudo apt-get install -y imagemagick | |
export JEKYLL_ENV=production | |
bundle exec jekyll build | |
- name: Purge unused CSS | |
run: | | |
npm install -g purgecss | |
purgecss -c purgecss.config.js | |
- name: Deploy | |
if: github.event_name != 'pull_request' | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: _site |