action.yml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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: Get version
  21. id: version-get
  22. run: |
  23. chmod +x ./scripts/get-version.bash
  24. VERSION=$(./scripts/get-version.bash)
  25. echo "version=${VERSION}" >> $GITHUB_OUTPUT
  26. if [ "$VERSION" != "0" ]; then
  27. echo "Version detected: $VERSION"
  28. else
  29. echo "No version detacted"
  30. fi
  31. shell: bash
  32. - name: Generate file name
  33. run: |
  34. USE_ALL_IN_ONE=""
  35. USE_MINIFIED=""
  36. if [ "${{ inputs.use-all-in-one }}" = "true" ]; then
  37. USE_ALL_IN_ONE=".allinone"
  38. fi
  39. if [ "${{ inputs.use-minified }}" = "true" ]; then
  40. USE_MINIFIED=".min"
  41. fi
  42. echo "file_name=index${USE_ALL_IN_ONE}${USE_MINIFIED}.html" >> $GITHUB_OUTPUT
  43. shell: bash
  44. - name: Deploy pre-generated markdown.html file
  45. uses: robinraju/release-downloader@v1
  46. with:
  47. repository: 'PJ-568/MAKRDOWN.HTML'
  48. tag: ${{ steps.version-get.outputs.version }}
  49. fileName: ${{ steps.file-name.outputs.file_name }}
  50. tarBall: false
  51. zipBall: false
  52. out-file-path: ${{ inputs.target-dir }}
  53. - name: Rename file
  54. run: |
  55. mv $GITHUB_WORKSPACE/${{ steps.file-name.outputs.file_name }} $GITHUB_WORKSPACE/${{ inputs.file-name }}
  56. shell: bash
  57. branding:
  58. icon: 'book-open'
  59. color: 'green'