Skip to content

Commit

Permalink
Create nbtomd.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
ajitjohnson committed Mar 4, 2024
1 parent fa7d26f commit 3d9a4aa
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/nbtomd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: nbtomd

on:
push:
branches:
- main
pull_request:
branches:
- main

permissions:
contents: write

jobs:
deploy:
runs-on: ubuntu-latest
env:
CI_COMMIT_MESSAGE: Continuous Integration Build Artifacts
CI_COMMIT_AUTHOR: Continuous Integration
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.x
- uses: actions/cache@v3
with:
key: ${{ github.ref }}
path: .cache
- run: pip install jupyter
- run: pip install nbconvert
- run: jupyter nbconvert --to markdown docs/Tutorials/notebooks/*.ipynb
#- run: mv docs/Tutorials/notebooks/*.md docs/Tutorials/
- run: |
for file in docs/Tutorials/notebooks/*; do
if [[ ! "$file" =~ \.ipynb$ ]]; then
rsync -av --remove-source-files "$file" docs/Tutorials/md/
fi
done
- run: ls docs/Tutorials/

- name: GIT Commit
# Only run on main branch push (e.g. after pull request merge).
if: github.event_name == 'push'
run: |
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
git config --global user.email "ajitjohnson@users.noreply.github.com"
git add docs/Tutorials/md/*
if [ -z "$(git status --porcelain)" ]; then
echo "Nothing to commit, working tree is clean."
exit 0
fi
git commit -m "${{ env.CI_COMMIT_MESSAGE }}"
git push

0 comments on commit 3d9a4aa

Please sign in to comment.