Merge pull request #222 from bsipocz/ENH_updates_to_fornax_deploy #208
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: Build and Publish HTML and update deploy_to_fornax | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| # `BASE_URL` determines, relative to the root of the domain, the URL that your site is served from. | |
| # E.g., if your site lives at `https://mydomain.org/myproject`, set `BASE_URL=/myproject`. | |
| # If, instead, your site lives at the root of the domain, at `https://mydomain.org`, set `BASE_URL=''`. | |
| BASE_URL: /${{ github.event.repository.name }} | |
| jobs: | |
| publish_html: | |
| if: >- | |
| (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && | |
| github.ref == 'refs/heads/main' && | |
| github.repository == 'Caltech-IPAC/irsa-tutorials' | |
| name: Publish HTML | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: Setup Python | |
| uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| run: python -m pip install --upgrade tox | |
| - name: Execute notebooks while building HTMLs | |
| run: tox -e py312-buildhtml | |
| - name: Publish | |
| uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./_build/html/ | |
| commit_message: ${{ github.event.head_commit.message }} | |
| deploy_notebooks: | |
| if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'Caltech-IPAC/irsa-tutorials' }} | |
| name: Deploy deploy_to_fornax branch | |
| runs-on: ubuntu-latest | |
| needs: publish_html | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: Deploy to deploy_to_fornax branch | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| gith=$(git rev-parse HEAD) | |
| git checkout --orphan deploy_to_fornax | |
| git rm --cached -r . | |
| git add --pathspec-from-file=deploy_to_fornax_manifest.in --force | |
| git commit -m "Deploy for fornax for commit ${gith}" | |
| # Do Fornax preferred renaming | |
| git mv tutorials irsa-tutorials | |
| git mv tutorial_requirements.txt irsa-tutorials/requirements-irsa-tutorials.txt | |
| git commit -m "Restructuring to help fornax deployment" | |
| git push origin deploy_to_fornax --force |