Revise README for clarity and detail #6
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: CD — Build & Push Docker Images | |
| on: | |
| push: | |
| branches: ["main"] | |
| tags: ["v*.*.*"] | |
| env: | |
| REGISTRY: ghcr.io | |
| # Images are scoped to the repository owner (your GitHub username / org) | |
| SERVER_IMAGE: ${{ github.repository_owner }}/formulary-server | |
| CLIENT_IMAGE: ${{ github.repository_owner }}/formulary-client | |
| jobs: | |
| # Build & push the backend image | |
| build-server: | |
| name: Build Server Image | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract Docker metadata (tags & labels) | |
| id: meta-server | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.SERVER_IMAGE }} | |
| tags: | | |
| type=ref,event=branch | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=sha,prefix=sha-,format=short | |
| - name: Build and push server image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./server | |
| push: true | |
| tags: ${{ steps.meta-server.outputs.tags }} | |
| labels: ${{ steps.meta-server.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| # Build & push the frontend image | |
| build-client: | |
| name: Build Client Image | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract Docker metadata (tags & labels) | |
| id: meta-client | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.CLIENT_IMAGE }} | |
| tags: | | |
| type=ref,event=branch | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=sha,prefix=sha-,format=short | |
| - name: Build and push client image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./client | |
| push: true | |
| build-args: | | |
| VITE_API_URL=${{ secrets.VITE_API_URL }} | |
| tags: ${{ steps.meta-client.outputs.tags }} | |
| labels: ${{ steps.meta-client.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |