name: Deploy markdown.html
description: Compress markdown.html and deploy to target directory
author: 'PJ568'
inputs:
target-dir:
description: Directory to deploy the minimized HTML file
default: "."
file-name:
description: Name of the minimized HTML file
default: "index.html"
use-minified:
description: Whether to use minified HTML file
default: "true"
use-all-in-one:
description: Whether to use all-in-one HTML file
default: "false"
runs:
using: "composite"
steps:
- name: Setup Rust
uses: MatteoH2O1999/setup-rust@v1
if: ${{ inputs.use-minified == 'true' || inputs.use-all-in-one == 'true' }}
working-directory: ${{ github.action_path }}
- name: Cache Rust dependencies
if: ${{ inputs.use-minified == 'true' || inputs.use-all-in-one == 'true' }}
uses: Swatinem/rust-cache@v2
working-directory:
with:
workspaces: "${{ github.action_path }} -> target"
cache-on-failure: "true"
- name: Build project
if: ${{ inputs.use-minified == 'true' || inputs.use-all-in-one == 'true' }}
run: cargo build --release
shell: bash
working-directory: ${{ github.action_path }}
- name: Generate minimized HTML
if: ${{ inputs.use-minified == 'true' || inputs.use-all-in-one == 'true' }}
run: cargo run --release -- index.html
shell: bash
working-directory: ${{ github.action_path }}
- name: Deploy file
run: |
mkdir -p "${{ inputs.target-dir }}"
USE_MINIFIED=""
USE_ALL_IN_ONE=""
if [ "${{ inputs.use-minified }}" = "true" ]; then
USE_MINIFIED=".min"
fi
if [ "${{ inputs.use-all-in-one }}" = "true" ]; then
USE_ALL_IN_ONE=".allinone"
fi
cp -uv index${USE_ALL_IN_ONE}${USE_MINIFIED}.html "${{ inputs.target-dir }}/${{ inputs.file-name }}"
shell: bash
working-directory: ${{ github.action_path }}
branding:
icon: 'book-open'
color: 'green'