Skip to content

docs: mark issue #14 as completed #10

docs: mark issue #14 as completed

docs: mark issue #14 as completed #10

Workflow file for this run

name: Continuous Deployment

Check failure on line 1 in .github/workflows/cd.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/cd.yml

Invalid workflow file

(Line: 62, Col: 13): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.SLACK_WEBHOOK != ''
on:
workflow_dispatch:
inputs:
environment:
description: "Environment to deploy"
required: true
default: staging
type: choice
options:
- staging
- production
push:
tags:
- 'v*.*.*'
permissions:
contents: read
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
environment: ${{ steps.set-env.outputs.environment }}
steps:
- id: set-env
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "environment=${{ github.event.inputs.environment }}" >> "$GITHUB_OUTPUT"
else
echo "environment=production" >> "$GITHUB_OUTPUT"
fi
deploy:
needs: prepare
runs-on: ubuntu-latest
environment: ${{ needs.prepare.outputs.environment }}
steps:
- uses: actions/checkout@v4
- name: Select kubeconfig secret
id: kubeconfig
run: |
if [ "${{ needs.prepare.outputs.environment }}" = "staging" ]; then
echo "secret=${{ secrets.KUBE_CONFIG_STAGING }}" >> "$GITHUB_OUTPUT"
echo "health_script=scripts/ci/health-check-staging.sh" >> "$GITHUB_OUTPUT"
else
echo "secret=${{ secrets.KUBE_CONFIG_PROD }}" >> "$GITHUB_OUTPUT"
echo "health_script=scripts/ci/health-check-production.sh" >> "$GITHUB_OUTPUT"
fi
- name: Configure kubectl
uses: azure/k8s-set-context@v3
with:
method: kubeconfig
kubeconfig: ${{ steps.kubeconfig.outputs.secret }}
- name: Apply manifests
run: |
kubectl apply -f infrastructure/kubernetes/${{ needs.prepare.outputs.environment }}
- name: Run environment smoke checks
run: ${{ steps.kubeconfig.outputs.health_script }}
- name: Notify Slack
if: secrets.SLACK_WEBHOOK != ''
uses: slackapi/[email protected]
with:
payload: |
{
"text": "Deployment to ${{ needs.prepare.outputs.environment }} completed with status ${{ job.status }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}