Update iNatle #10
This file contains hidden or 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: Update iNatle | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| build-shinylive: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Disable man-db update | |
| run: | | |
| sudo rm -f /var/lib/man-db/auto-update # speeds up R install | |
| - name: Set up R | |
| uses: r-lib/actions/setup-r@v2 | |
| with: | |
| use-public-rspm: true | |
| - name: Install dependencies | |
| run: | | |
| Rscript -e 'install.packages(c("shinylive", "i18n"))' | |
| - name: Export app with R shinylive | |
| run: | | |
| git clone https://github.com/rmcminds/iNatle.git iNatle # clone app repo | |
| rm -rf iNatle_raw/ # delete the old app | |
| Rscript -e 'shinylive::export("iNatle/iNatle", "iNatle_raw/", template_dir = "scripts/shinylive_embedded_jekyll_template", template_params = list(title = "iNatle"))' # export the app using custom shinylive template to make sure there's jekyll frontmatter on the export | |
| sed -i 's/viewerFrameRef.current.src = appInfo.urlPath/viewerFrameRef.current.src = appInfo.urlPath + window.location.search;/g' iNatle_raw/shinylive/shinylive.js # edit shinylive.js so the url parameters are forwarded to the iframe | |
| rm -rf iNatle # remove cloned repo | |
| - name: Commit and push | |
| run: | | |
| git config --global user.email "github-actions[bot]" | |
| git config --global user.name "github-actions[bot]@users.noreply.github.com" | |
| git add . | |
| git commit -m "Update iNatle" || echo "No changes to commit" | |
| git push | |