Merge pull request #31 from pythonhealthdatascience/dev #22
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: Publish docker on GHCR, then render and deploy quarto on GitHub pages | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| inputs: | |
| force_docker_build: | |
| description: 'Force Docker build (skip change detection)' | |
| required: true | |
| type: boolean | |
| default: false | |
| skip_docker_build: | |
| description: 'Skip Docker build (use last built image)' | |
| required: true | |
| type: boolean | |
| default: false | |
| jobs: | |
| publish-docker: | |
| name: Publish docker | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Check if Docker build needed | |
| id: changes | |
| uses: dorny/paths-filter@v3 | |
| with: | |
| filters: | | |
| docker: | |
| - 'Dockerfile' | |
| - 'environment.yaml' | |
| - 'renv.lock' | |
| - 'renv/**' | |
| - name: Login to GitHub Container Registry | |
| if: > | |
| (!inputs.skip_docker_build) && | |
| (inputs.force_docker_build || steps.changes.outputs.docker == 'true') | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build the Docker image | |
| if: > | |
| (!inputs.skip_docker_build) && | |
| (inputs.force_docker_build || steps.changes.outputs.docker == 'true') | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| tags: | | |
| ghcr.io/pythonhealthdatascience/stars-testing-intro:latest | |
| push: true | |
| build-deploy: | |
| runs-on: ubuntu-latest | |
| needs: [publish-docker] | |
| container: | |
| image: ghcr.io/pythonhealthdatascience/stars-testing-intro:latest | |
| credentials: | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| permissions: | |
| contents: write | |
| packages: read | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Configure Git safe directory | |
| run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
| - name: Render and publish to GitHub pages | |
| uses: quarto-dev/quarto-actions/publish@v2 | |
| with: | |
| target: gh-pages | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |