Merge pull request #218 from openzim/healthcheck-optional-auth #34
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 | |
| on: | |
| push: | |
| branches: | |
| - "main" | |
| workflow_dispatch: | |
| inputs: | |
| force: | |
| description: "Force publish all components" | |
| required: false | |
| type: boolean | |
| default: false | |
| force_components: | |
| description: "Force publish specific components (comma-separated: backend, frontend, healthcheck)" | |
| required: false | |
| type: string | |
| default: "" | |
| jobs: | |
| paths-filter: | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| backend: ${{ steps.filter.outputs.backend || 'false'}} | |
| frontend: ${{ steps.filter.outputs.frontend || 'false'}} | |
| healthcheck: ${{ steps.filter.outputs.healthcheck || 'false'}} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: dorny/paths-filter@v3 | |
| id: filter | |
| if: github.event_name == 'push' | |
| with: | |
| filters: | | |
| backend: | |
| - 'backend/**' | |
| frontend: | |
| - 'frontend/**' | |
| healthcheck: | |
| - 'healthcheck/**' | |
| backend: | |
| name: Backend build and publish | |
| runs-on: ubuntu-24.04 | |
| needs: paths-filter | |
| if: ${{ needs.paths-filter.outputs.backend == 'true' || inputs.force == true || contains(inputs.force_components, 'backend') }} | |
| steps: | |
| - name: Retrieve source code | |
| uses: actions/checkout@v5 | |
| - name: Build and publish Docker Image for backend mill | |
| uses: openzim/docker-publish-action@v10 | |
| with: | |
| image-name: openzim/cms-mill | |
| on-master: latest | |
| restrict-to: openzim/cms | |
| context: backend | |
| dockerfile: Dockerfile-mill | |
| registries: ghcr.io | |
| credentials: GHCRIO_USERNAME=${{ secrets.GHCR_USERNAME }} | |
| GHCRIO_TOKEN=${{ secrets.GHCR_TOKEN }} | |
| - name: Build and publish Docker Image for backend shuttle | |
| uses: openzim/docker-publish-action@v10 | |
| with: | |
| image-name: openzim/cms-shuttle | |
| on-master: latest | |
| restrict-to: openzim/cms | |
| context: backend | |
| dockerfile: Dockerfile-shuttle | |
| registries: ghcr.io | |
| credentials: GHCRIO_USERNAME=${{ secrets.GHCR_USERNAME }} | |
| GHCRIO_TOKEN=${{ secrets.GHCR_TOKEN }} | |
| - name: Build and publish Docker Image for backend API | |
| uses: openzim/docker-publish-action@v10 | |
| with: | |
| image-name: openzim/cms-api | |
| on-master: latest | |
| restrict-to: openzim/cms | |
| context: backend | |
| dockerfile: Dockerfile-api | |
| registries: ghcr.io | |
| credentials: GHCRIO_USERNAME=${{ secrets.GHCR_USERNAME }} | |
| GHCRIO_TOKEN=${{ secrets.GHCR_TOKEN }} | |
| # mill should be first since it deploys the alembic migration | |
| - name: Deploy CMS Mill changes to cms.openzim.org | |
| uses: actions-hub/kubectl@master | |
| env: | |
| KUBE_CONFIG: ${{ secrets.CMS_KUBE_CONFIG }} | |
| with: | |
| args: rollout restart deployments mill-deployment -n cms | |
| - name: Deploy CMS Shuttle changes to cms.openzim.org | |
| uses: actions-hub/kubectl@master | |
| env: | |
| KUBE_CONFIG: ${{ secrets.ZIM_KUBE_CONFIG }} | |
| with: | |
| args: rollout restart deployments cms-shuttle-deployment -n zim | |
| - name: Deploy CMS API changes to cms.openzim.org | |
| uses: actions-hub/kubectl@master | |
| env: | |
| KUBE_CONFIG: ${{ secrets.CMS_KUBE_CONFIG }} | |
| with: | |
| args: rollout restart deployments api-deployment -n cms | |
| frontend: | |
| name: Frontend build and publish | |
| runs-on: ubuntu-24.04 | |
| needs: paths-filter | |
| if: ${{ needs.paths-filter.outputs.frontend == 'true' || inputs.force == true || contains(inputs.force_components, 'frontend') }} | |
| steps: | |
| - name: Retrieve source code | |
| uses: actions/checkout@v5 | |
| - name: Build and publish Docker Image | |
| uses: openzim/docker-publish-action@v10 | |
| with: | |
| image-name: openzim/cms-ui | |
| on-master: latest | |
| restrict-to: openzim/cms | |
| context: frontend | |
| registries: ghcr.io | |
| credentials: GHCRIO_USERNAME=${{ secrets.GHCR_USERNAME }} | |
| GHCRIO_TOKEN=${{ secrets.GHCR_TOKEN }} | |
| - name: Deploy CMS UI changes to cms.openzim.org | |
| uses: actions-hub/kubectl@master | |
| env: | |
| KUBE_CONFIG: ${{ secrets.CMS_KUBE_CONFIG }} | |
| with: | |
| args: rollout restart deployments ui-deployment -n cms | |
| healthcheck: | |
| name: Healthcheck build and publish | |
| runs-on: ubuntu-24.04 | |
| needs: paths-filter | |
| if: ${{ needs.paths-filter.outputs.healthcheck == 'true' || inputs.force == true || contains(inputs.force_components, 'healthcheck') }} | |
| steps: | |
| - name: Retrieve source code | |
| uses: actions/checkout@v6 | |
| - name: Build and publish Docker Image | |
| uses: openzim/docker-publish-action@v10 | |
| with: | |
| image-name: openzim/cms-healthcheck | |
| on-master: latest | |
| restrict-to: openzim/cms | |
| context: healthcheck | |
| registries: ghcr.io | |
| credentials: GHCRIO_USERNAME=${{ secrets.GHCR_USERNAME }} | |
| GHCRIO_TOKEN=${{ secrets.GHCR_TOKEN }} | |
| - name: Deploy Healthcheck changes to cms.openzim.org | |
| uses: actions-hub/kubectl@master | |
| env: | |
| KUBE_CONFIG: ${{ secrets.CMS_KUBE_CONFIG }} | |
| with: | |
| args: rollout restart deployments status-deployment -n cms |