CD Workflow #237
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 Workflow | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| service: | |
| description: 'Service to deploy' | |
| required: true | |
| type: string | |
| folder: | |
| description: folder the service is in | |
| required: true | |
| type: string | |
| version: | |
| description: 'Version tag (e.g., frontend-1.0.1)' | |
| required: true | |
| type: string | |
| sha: | |
| description: 'Git commit SHA' | |
| required: true | |
| type: string | |
| permissions: | |
| packages: write | |
| contents: read | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ inputs.sha }} | |
| - 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: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push Service | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./${{ inputs.folder }} | |
| file: ./${{ inputs.folder }}/Dockerfile | |
| push: true | |
| tags: | | |
| ghcr.io/vchen7629/cyphria-${{ inputs.service }}:${{ inputs.sha }} | |
| ghcr.io/vchen7629/cyphria-${{ inputs.service }}:${{ inputs.version }} | |
| ghcr.io/vchen7629/cyphria-${{ inputs.service }}:latest | |
| - name: Trigger update kubernetes manifests for Service | |
| run: | | |
| gh workflow run update_kubernetes_manifests.yaml \ | |
| -f service=${{ inputs.service }} \ | |
| -f version=${{ inputs.version }} \ | |
| env: | |
| GH_TOKEN: ${{ secrets.CI_CD_PAT }} |