action.yml 1.5 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: Relative path under $GITHUB_WORKSPACE 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: Generate file name
  21. id: gen-file-name
  22. run: |
  23. USE_ALL_IN_ONE=""
  24. USE_MINIFIED=""
  25. if [ "${{ inputs.use-all-in-one }}" = "true" ]; then
  26. USE_ALL_IN_ONE=".allinone"
  27. fi
  28. if [ "${{ inputs.use-minified }}" = "true" ]; then
  29. USE_MINIFIED=".min"
  30. fi
  31. echo "file_name=index${USE_ALL_IN_ONE}${USE_MINIFIED}.html" >> $GITHUB_OUTPUT
  32. echo "index${USE_ALL_IN_ONE}${USE_MINIFIED}.html"
  33. shell: bash
  34. - name: Deploy pre-generated markdown.html file
  35. uses: robinraju/release-downloader@v1
  36. with:
  37. repository: 'PJ-568/MARKDOWN.HTML'
  38. latest: true
  39. fileName: ${{ steps.gen-file-name.outputs.file_name }}
  40. tarBall: false
  41. zipBall: false
  42. out-file-path: ${{ inputs.target-dir }}
  43. - name: Rename file
  44. run: |
  45. mv -v $GITHUB_WORKSPACE/${{ steps.gen-file-name.outputs.file_name }} $GITHUB_WORKSPACE/${{ inputs.file-name }}
  46. shell: bash
  47. branding:
  48. icon: 'book-open'
  49. color: 'green'