action.yml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. name: Deploy markdown.html
  2. description: Compress markdown.html and deploy to target directory
  3. author: 'PJ568'
  4. inputs:
  5. target-dir:
  6. description: Directory to deploy the minimized HTML file
  7. default: "."
  8. file-name:
  9. description: Name of the minimized HTML file
  10. default: "index.html"
  11. use-minified:
  12. description: Whether to use minified HTML file
  13. default: "true"
  14. use-all-in-one:
  15. description: Whether to use all-in-one HTML file
  16. default: "false"
  17. runs:
  18. using: "composite"
  19. steps:
  20. - name: Setup Rust
  21. uses: MatteoH2O1999/setup-rust@v1
  22. if: ${{ inputs.use-minified == 'true' || inputs.use-all-in-one == 'true' }}
  23. - name: Build project
  24. if: ${{ inputs.use-minified == 'true' || inputs.use-all-in-one == 'true' }}
  25. run: cargo build --release
  26. shell: bash
  27. working-directory: ${{ github.action_path }}
  28. - name: Generate minimized HTML
  29. if: ${{ inputs.use-minified == 'true' || inputs.use-all-in-one == 'true' }}
  30. run: cargo run --release -- index.html
  31. shell: bash
  32. working-directory: ${{ github.action_path }}
  33. - name: Deploy file
  34. run: |
  35. mkdir -p "${{ inputs.target-dir }}"
  36. USE_MINIFIED=""
  37. USE_ALL_IN_ONE=""
  38. if [ "${{ inputs.use-minified }}" = "true" ]; then
  39. USE_MINIFIED=".min"
  40. fi
  41. if [ "${{ inputs.use-all-in-one }}" = "true" ]; then
  42. USE_ALL_IN_ONE=".allinone"
  43. fi
  44. cp -uv index${USE_ALL_IN_ONE}${USE_MINIFIED}.html "${{ inputs.target-dir }}/${{ inputs.file-name }}"
  45. shell: bash
  46. working-directory: ${{ github.action_path }}
  47. branding:
  48. icon: 'book-open'
  49. color: 'green'