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