Skip to content

moved examples around #15

moved examples around

moved examples around #15

name: PlutoExampleBuilder
on:
workflow_dispatch:
push:
branches:
- pluto-test
paths:
- 'src/**'
- 'examples/pluto-src/**'
- '.github/workflows/PlutoExampleBuilder.yml'
- 'Project.toml'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "Check out repository"
uses: actions/checkout@v3
- name: "Set up Julia"
uses: julia-actions/setup-julia@v1
with:
version: '1.10'
- run: julia -e 'using Pkg; Pkg.add("PlutoSliderServer"); Pkg.add("FMIFlux")'
- run: julia -e 'using PlutoSliderServer; PlutoSliderServer.export_directory("examples/pluto-src")'
- name: Archive examples artifacts (success)
if: success()
uses: actions/upload-artifact@v3
with:
name: pluto-examples
path: examples/pluto-src/*
- name: Archive examples artifacts (failure)
if: failure()
uses: actions/upload-artifact@v3
with:
name: pluto-examples
path: examples/pluto-src/*
auto-commit:
needs: build
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Download examples
uses: actions/download-artifact@v3
with:
name: pluto-examples
path: examples/pluto-src/
- name: auto-commit
env:
CI_COMMIT_MESSAGE: Pluto static html exported files
CI_COMMIT_AUTHOR: github-actions[bot]
EXAMPLES_PATH: examples/pluto-src
# Fetch all and clear the stash list. Include all files from the examples/src folder to the stash and switch the branch.
# Reset the branch and remove all current files in the examples/src folder.
# Checkout the last stash to restore the new notebooks and apply the stash index to restore all other new files in the folder.
run: |
git fetch --all
git stash clear
git stash --include-untracked -- ${{ env.EXAMPLES_PATH }}
git switch examples
git reset --hard origin/examples
rm -rf ${{ env.EXAMPLES_PATH }}
git checkout stash -f -- ${{ env.EXAMPLES_PATH }}
git stash apply --index
git stash drop
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
git config --global user.email "${{ env.CI_COMMIT_AUTHOR }}@users.noreply.github.com"
git config --global core.autocrlf false
git add ${{ env.EXAMPLES_PATH }}
git commit -m "${{ env.CI_COMMIT_MESSAGE }}"
git push origin examples