docs: mark issue #14 as completed #10
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: Continuous Deployment | ||
| 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 }} | ||