diff --git a/3.1-github-CI-CD.qmd b/3.1-github-CI-CD.qmd index 49ec8cd..8b0b83f 100644 --- a/3.1-github-CI-CD.qmd +++ b/3.1-github-CI-CD.qmd @@ -178,9 +178,84 @@ jobs: 5. On GitHub, go to actions and trigger the workflow 6. Check out the results 🐍 -## A more complicated example 🧙 +## A more complicated example 🧙‍♀️ + +Rendering the slides *for this course*! ✨ ```yml +# .github/workflows/deploy.yml + +name: Render and Deploy + +on: + workflow_dispatch: + push: + branches: main + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: pages + cancel-in-progress: false + +jobs: + render: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Setup Pages + uses: actions/configure-pages@v4 + + - name: Set up Quarto + uses: quarto-dev/quarto-actions/setup@v2 + with: + tinytex: true + + - name: Render Slides + uses: quarto-dev/quarto-actions/render@v2 + + - name: Render README / index.html + run: quarto render README.qmd --to=html + - name: Move index.html to output + run: | + mv index.html output/index.html + mv README_files output/README_files + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: output + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + needs: render + runs-on: ubuntu-latest + name: Deploy + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 + +``` + +## Another complicated example 🧝 + +Rendering documentation for a software project. + +```{.yml code-line-numbers="|5-13"} # .github/workflows/deploy-docs.yml name: Build and Deploy Documentation @@ -300,6 +375,10 @@ I've never written a workflow file from scratch, you can either start with a sta ![GitHub provides easy starter templates for new workflows](images/screenshots/github/gh-new-workflow.png) +## Development of Workflows + +![Creating a new Workflow is often a bit of trial and error](images/screenshots/github/gh-actions-developing.png) + ## Further Reading - GitHub diff --git a/images/screenshots/github/gh-actions-developing.png b/images/screenshots/github/gh-actions-developing.png new file mode 100644 index 0000000..78996d8 Binary files /dev/null and b/images/screenshots/github/gh-actions-developing.png differ diff --git a/images/screenshots/github/gh-vscode.png b/images/screenshots/github/gh-vscode.png index 01b8954..e7a7629 100644 Binary files a/images/screenshots/github/gh-vscode.png and b/images/screenshots/github/gh-vscode.png differ