Production Release CI/CD #34
This file contains 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: Production Release CI/CD | |
on: | |
workflow_dispatch: | |
inputs: | |
deploy-service: | |
description: "Name of the service to deploy" | |
required: true | |
type: string | |
deploy-tag: | |
description: "Tag for deployment" | |
required: true | |
type: string | |
jobs: | |
pre-release: | |
runs-on: ubuntu-latest | |
outputs: | |
packages_deployment: ${{ steps.generate-deployment.outputs.PACKAGES_DEPLOYMENT }} | |
steps: | |
- name: generate production deployment manifest | |
id: generate-deployment | |
run: | | |
packages_deployment=$(echo '["${{ inputs.deploy-service }}"]' | jq -c 'map({name: ., imageTag:"ghcr.io/stamford-syntax-club/course-compose/\(.):prod-${{ inputs.deploy-tag }}"})') | |
echo "PACKAGES_DEPLOYMENT=$packages_deployment" >> $GITHUB_OUTPUT | |
echo "PACKAGES_DEPLOYMENT=$packages_deployment" | |
deploy-ghcr: | |
needs: pre-release | |
if: ${{ needs.pre-release.outputs.packages_deployment != '[]' }} | |
uses: ./.github/workflows/deploy-ghcr.yaml | |
with: | |
packages_deployment: ${{ needs.pre-release.outputs.packages_deployment }} | |
environment: production | |
gitops-prod: | |
needs: [pre-release, deploy-ghcr] | |
if: ${{ needs.pre-release.outputs.packages_deployment != '[]' }} | |
uses: ./.github/workflows/gitops.yaml | |
with: | |
packages_deployment: ${{ needs.pre-release.outputs.packages_deployment }} | |
environment: production | |
secrets: | |
workflow_token: ${{ secrets.WORKFLOW_TOKEN }} |