Update deploy-gh-pages.yml #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy documentation to GitHub Pages | |
on: | |
push: | |
branches: | |
- main # Trigger only on changes to the main branch | |
workflow_dispatch: # Allows manual trigger | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
pip install nbconvert | |
- name: Copy site | |
run: | | |
mkdir -p _site | |
cp *.md _site/ | |
cp -r documentation _site/ | |
cp -r config _site/ | |
cp -r tools _site/ | |
cp -r misp-playbooks _site/ | |
- name: Ensure there is no '.nojekyll' | |
run: | | |
rm .nojekyll | |
- name: Convert site | |
run: | | |
find -name "*.ipynb" -exec jupyter nbconvert --to html {} \; | |
find _site -type f -name "*.md" -exec sed -i 's/\.md/\.html/g' {} \; | |
find _site -type f -name "*.md" -exec sed -i 's/\.ipynb/\.html/g' {} \; | |
#- name: Deploy to gh-pages branch | |
# uses: peaceiris/actions-gh-pages@v4 | |
# with: | |
# github_token: ${{ secrets.GITHUB_TOKEN }} | |
# publish_dir: ./_site | |
# branch: gh-pages | |
# force_orphan: true # Ensure gh-pages branch only contains docs | |
- name: Commit and push updated README | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
git add --all | |
git commit -m "Deploy all files to GitHub Pages" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |