Skip to content

Commit b784e83

Browse files
authored
Refactor deploy workflow for MkDocs build and deploy
1 parent ebac593 commit b784e83

1 file changed

Lines changed: 38 additions & 34 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -110,40 +110,6 @@ jobs:
110110
-H "Content-Type: application/json" \
111111
-d "{\"team_reviewers\":[\"ai4sdlc-approval\"]}" \
112112
https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER/requested_reviewers -v
113-
114-
115-
###
116-
# Build stage - converting md file to html using MkDocs
117-
convert_md_to_html_gh :
118-
runs-on: ubuntu-latest
119-
if: github.ref != 'refs/heads/main' # Run for non-main branches
120-
steps:
121-
- name: Checkout code
122-
uses: actions/checkout@v3
123-
124-
- name: Set up Python
125-
uses: actions/setup-python@v4
126-
with:
127-
python-version: 3.9
128-
129-
- name: Install MkDocs and dependencies
130-
run: |
131-
pip install mkdocs mkdocs-material
132-
133-
- name: Build project with MkDocs
134-
run: |
135-
echo "Building your project..."
136-
mkdocs build
137-
echo "pwd in build project with MKDocs"
138-
- name: Add .nojekyll
139-
run: touch site/.nojekyll
140-
141-
- name: Deploy to GitHub Pages
142-
uses: peaceiris/actions-gh-pages@v4
143-
with:
144-
github_token: ${{ secrets.GITHUB_TOKEN }}
145-
publish_dir: ./site
146-
###
147113

148114
# Build stage - converting md file to html using MkDocs
149115
convert_md_to_html:
@@ -272,3 +238,41 @@ jobs:
272238
# Delete contents of the pr folder
273239
aws s3 rm s3://$S3_BUCKET_NAME/mergeRequest/$PR_NUMBER --recursive
274240
echo "PR folder deleted successfully !!!"
241+
242+
###
243+
# Build stage - converting md file to html using MkDocs
244+
deploy_to_page :
245+
runs-on: ubuntu-latest
246+
if: github.event_name == 'pull_request' &&
247+
github.event.action == 'closed' &&
248+
github.event.pull_request.merged == true &&
249+
github.event.pull_request.base.ref == 'main'
250+
steps:
251+
- name: Checkout code
252+
uses: actions/checkout@v3
253+
254+
- name: Set up Python
255+
uses: actions/setup-python@v4
256+
with:
257+
python-version: 3.9
258+
259+
- name: Install MkDocs and dependencies
260+
run: |
261+
pip install mkdocs mkdocs-material
262+
263+
- name: Build project with MkDocs
264+
run: |
265+
echo "Building your project..."
266+
mkdocs build
267+
echo "pwd in build project with MKDocs"
268+
269+
- name: Add .nojekyll
270+
run: touch site/.nojekyll
271+
272+
- name: Deploy to GitHub Pages
273+
uses: peaceiris/actions-gh-pages@v4
274+
with:
275+
github_token: ${{ secrets.GITHUB_TOKEN }}
276+
publish_dir: ./site
277+
###
278+

0 commit comments

Comments
 (0)