fix(ci): deploy via gitops from github actions
This commit is contained in:
parent
752e331126
commit
cbaff36f88
1 changed files with 0 additions and 22 deletions
22
.github/workflows/build-and-deploy-ghcr.yml
vendored
22
.github/workflows/build-and-deploy-ghcr.yml
vendored
|
|
@ -48,28 +48,6 @@ jobs:
|
|||
platforms: linux/amd64
|
||||
tags: ${{ env.IMAGE_NAME }}:${{ github.sha }}
|
||||
|
||||
- name: Configure kubeconfig
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p ~/.kube
|
||||
printf '%s' '${{ secrets.KUBE_CONFIG_DATA }}' | base64 -d > ~/.kube/config
|
||||
chmod 600 ~/.kube/config
|
||||
|
||||
- name: Install kubectl
|
||||
uses: azure/setup-kubectl@v4
|
||||
|
||||
- name: Deploy to Kubernetes
|
||||
env:
|
||||
GHCR_USERNAME: ${{ secrets.GHCR_USERNAME }}
|
||||
GHCR_TOKEN: ${{ secrets.DEPLOY_GITHUB_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
image_ref="${IMAGE_NAME}@${{ steps.build.outputs.digest }}"
|
||||
kubectl -n "$K8S_NAMESPACE" create secret docker-registry ghcr-regcred --docker-server=ghcr.io --docker-username="$GHCR_USERNAME" --docker-password="$GHCR_TOKEN" --dry-run=client -o yaml | kubectl apply -f -
|
||||
kubectl -n "$K8S_NAMESPACE" patch deployment "$DEPLOYMENT_NAME" --type merge -p '{"spec":{"template":{"spec":{"imagePullSecrets":[{"name":"ghcr-regcred"}]}}}}'
|
||||
kubectl -n "$K8S_NAMESPACE" set image deployment/"$DEPLOYMENT_NAME" "$CONTAINER_NAME"="$image_ref"
|
||||
kubectl -n "$K8S_NAMESPACE" rollout status deployment/"$DEPLOYMENT_NAME" --timeout=10m
|
||||
|
||||
- name: Sync GitOps release
|
||||
env:
|
||||
GITOPS_TOKEN: ${{ secrets.DEPLOY_GITHUB_TOKEN }}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue