CreateDocs.yml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. name: CreateDocs
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. branches:
  6. description: "JSON array of branches: ['18','20'] (no spaces)"
  7. required: false
  8. type: string
  9. schedule:
  10. # Times are UTC
  11. - cron: '0 04 * * *'
  12. env:
  13. ASTERISK_REPO: ${{ github.repository }}
  14. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  15. GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  16. DEFAULT_BRANCHES: ${{ vars.WIKIDOC_BRANCHES }}
  17. INPUT_BRANCHES: ${{ inputs.branches }}
  18. jobs:
  19. CreateDocsDebug:
  20. runs-on: ubuntu-latest
  21. outputs:
  22. manual_branches: ${{ steps.setup.outputs.manual_branches }}
  23. steps:
  24. - name: setup
  25. run: |
  26. MANUAL_BRANCHES="$INPUT_BRANCHES"
  27. [ -z "$MANUAL_BRANCHES" ] && MANUAL_BRANCHES="$DEFAULT_BRANCHES" || :
  28. echo "manual_branches=${MANUAL_BRANCHES}"
  29. echo "manual_branches=${MANUAL_BRANCHES}" >>${GITHUB_OUTPUT}
  30. exit 0
  31. - name: DumpEnvironment
  32. uses: asterisk/asterisk-ci-actions/DumpEnvironmentAction@main
  33. with:
  34. action-inputs: ${{toJSON(inputs)}}
  35. action-vars: ${{ toJSON(steps.setup.outputs) }}
  36. CreateDocsScheduledMatrix:
  37. needs: [ CreateDocsDebug ]
  38. if: ${{github.event_name == 'schedule' && fromJSON(vars.WIKIDOCS_ENABLE) == true }}
  39. continue-on-error: false
  40. strategy:
  41. fail-fast: false
  42. matrix:
  43. branch: ${{ fromJSON(vars.WIKIDOC_BRANCHES) }}
  44. runs-on: ubuntu-latest
  45. steps:
  46. - name: CreateDocs for ${{matrix.branch}}
  47. uses: asterisk/asterisk-ci-actions/CreateAsteriskDocsComposite@main
  48. with:
  49. asterisk_repo: ${{env.ASTERISK_REPO}}
  50. base_branch: ${{matrix.branch}}
  51. docs_dir: docs_dir/${{matrix.branch}}
  52. github_token: ${{secrets.GITHUB_TOKEN}}
  53. CreateDocsScheduled:
  54. needs: [ CreateDocsScheduledMatrix ]
  55. if: ${{ success() || failure() }}
  56. runs-on: ubuntu-latest
  57. steps:
  58. - name: Check CreateDocsScheduledMatrix status
  59. env:
  60. RESULT: ${{needs.CreateDocsScheduledMatrix.result}}
  61. GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  62. run: |
  63. case $RESULT in
  64. success)
  65. echo "::notice::Docs created"
  66. exit 0
  67. ;;
  68. skipped)
  69. echo "::notice::Skipped"
  70. exit 1
  71. ;;
  72. *)
  73. echo "::error::One or CreateDocs failed ($RESULT)"
  74. exit 1
  75. esac
  76. CreateDocsManualMatrix:
  77. needs: [ CreateDocsDebug ]
  78. if: ${{github.event_name == 'workflow_dispatch'}}
  79. continue-on-error: false
  80. strategy:
  81. fail-fast: false
  82. matrix:
  83. branch: ${{ fromJSON(vars.WIKIDOC_MANUAL_BRANCHES) }}
  84. runs-on: ubuntu-latest
  85. steps:
  86. - name: CreateDocs for ${{matrix.branch}}
  87. uses: asterisk/asterisk-ci-actions/CreateAsteriskDocsComposite@main
  88. with:
  89. asterisk_repo: ${{env.ASTERISK_REPO}}
  90. base_branch: ${{matrix.branch}}
  91. docs_dir: docs_dir/${{matrix.branch}}
  92. github_token: ${{secrets.GITHUB_TOKEN}}
  93. CreateDocsManual:
  94. needs: [ CreateDocsManualMatrix ]
  95. if: ${{ success() || failure() }}
  96. runs-on: ubuntu-latest
  97. steps:
  98. - name: Check CreateDocsManualMatrix status
  99. env:
  100. RESULT: ${{needs.CreateDocsManualMatrix.result}}
  101. GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  102. run: |
  103. case $RESULT in
  104. success)
  105. echo "::notice::Docs created"
  106. exit 0
  107. ;;
  108. skipped)
  109. echo "::notice::Skipped"
  110. exit 1
  111. ;;
  112. *)
  113. echo "::error::One or CreateDocs failed ($RESULT)"
  114. exit 1
  115. esac