-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fa7d26f
commit 3d9a4aa
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
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
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 |