|
6 | 6 | branches: [main] |
7 | 7 | release: |
8 | 8 | types: [published] |
| 9 | + workflow_dispatch: |
| 10 | + inputs: |
| 11 | + environment: |
| 12 | + description: "The environment to deploy to" |
| 13 | + required: true |
| 14 | + type: choice |
| 15 | + default: "staging" |
| 16 | + options: |
| 17 | + - staging |
| 18 | + - production |
9 | 19 |
|
10 | 20 | jobs: |
11 | 21 | build-docs: |
|
30 | 40 | - name: Build Docs |
31 | 41 | run: make all_docs |
32 | 42 |
|
33 | | - - name: Deploy (Push to main) |
34 | | - if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
| 43 | + - name: Deploy (Push to main or Pull Request) |
| 44 | + if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'staging') |
35 | 45 | uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0 |
36 | 46 | with: |
37 | 47 | github_token: ${{ secrets.GITHUB_TOKEN }} |
|
41 | 51 | user_email: 41898282+github-actions[bot]@users.noreply.github.com |
42 | 52 |
|
43 | 53 | - name: Deploy (Release) |
44 | | - if: github.event_name == 'release' |
| 54 | + if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'production') |
45 | 55 | uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0 |
46 | 56 | with: |
47 | 57 | github_token: ${{ secrets.GITHUB_TOKEN }} |
|
52 | 62 | tag_name: ${{ github.event.release.tag_name }} |
53 | 63 | tag_message: 'Documentation for release ${{ github.event.release.tag_name }}' |
54 | 64 |
|
55 | | - - name: Trigger mintlify workflow (Push to main) |
56 | | - if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
| 65 | + - name: Trigger mintlify workflow (Push to main or Pull Request) |
| 66 | + if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'staging') |
57 | 67 | uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 |
58 | 68 | with: |
59 | 69 | github-token: ${{ secrets.DOCS_WORKFLOW_TOKEN }} |
|
66 | 76 | }); |
67 | 77 |
|
68 | 78 | - name: Trigger mintlify workflow (Release) |
69 | | - if: github.event_name == 'release' |
| 79 | + if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'production') |
70 | 80 | uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 |
71 | 81 | with: |
72 | 82 | github-token: ${{ secrets.DOCS_WORKFLOW_TOKEN }} |
|
76 | 86 | repo: 'docs', |
77 | 87 | workflow_id: 'mintlify-action.yml', |
78 | 88 | ref: 'main', |
79 | | - inputs: { |
80 | | - version: '${{ github.event.release.tag_name }}', |
81 | | - is_release: 'true' |
82 | | - } |
83 | 89 | }); |
0 commit comments