Update index.md #175
Workflow file for this run
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: Compile course | |
| on: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: 3.9 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install poetry | |
| poetry install -E ghp-compiled --no-root | |
| - name: Compile the courses | |
| run: | | |
| poetry run python -m naucse_render compile _compiled \ | |
| --edit-repo-url https://github.com/${{ github.repository }} \ | |
| --edit-repo-branch ${{ github.ref_name }} | |
| - if: ${{ startsWith(github.ref, 'refs/heads/') }} | |
| name: Create compiled branch if not existent | |
| run: | | |
| if git fetch origin compiled/${{ github.ref_name }}; then | |
| echo "Branch exists: compiled/${{ github.ref_name }}" | |
| else | |
| git checkout --orphan compiled/${{ github.ref_name }} | |
| git commit --allow-empty -m "Initialize compiled/${{ github.ref_name }} branch" | |
| git push origin compiled/${{ github.ref_name }} | |
| git checkout ${{ github.ref_name }} | |
| fi | |
| env: | |
| GIT_AUTHOR_NAME: ghp_import | |
| GIT_COMMITTER_NAME: ghp_import | |
| EMAIL: none@invalid | |
| - if: ${{ startsWith(github.ref, 'refs/heads/') }} | |
| name: Publish compiled courses | |
| run: | | |
| git fetch origin compiled/${{ github.ref_name }} | |
| poetry run python -m ghp_import -m "Compiled" -b compiled/${{ github.ref_name }} --push _compiled/ | |
| curl -H 'Content-Type: application/json' \ | |
| --data '{"repository": "https://github.com/${{ github.repository }}", "branch": "compiled/${{ github.ref_name }}"}' \ | |
| https://hooks.nauc.se/trigger | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GIT_AUTHOR_NAME: ghp_import | |
| GIT_COMMITTER_NAME: ghp_import | |
| EMAIL: none@invalid |