fix(ci): deploy via gitops from github actions
This commit is contained in:
parent
22ee7f8544
commit
74dad77614
1 changed files with 0 additions and 24 deletions
24
.github/workflows/build-and-deploy-ghcr.yml
vendored
24
.github/workflows/build-and-deploy-ghcr.yml
vendored
|
|
@ -71,30 +71,6 @@ jobs:
|
||||||
SERVICE_NAME=${{ matrix.service }}
|
SERVICE_NAME=${{ matrix.service }}
|
||||||
tags: ghcr.io/traceworks2023/nxtgauge-rust-${{ matrix.service }}:${{ github.sha }}
|
tags: ghcr.io/traceworks2023/nxtgauge-rust-${{ matrix.service }}:${{ 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
|
|
||||||
deployment="nxtgauge-rust-${{ matrix.service }}"
|
|
||||||
container="${{ matrix.service }}"
|
|
||||||
image_ref="ghcr.io/traceworks2023/nxtgauge-rust-${{ matrix.service }}@${{ 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" --type merge -p '{"spec":{"template":{"spec":{"imagePullSecrets":[{"name":"ghcr-regcred"}]}}}}'
|
|
||||||
kubectl -n "$K8S_NAMESPACE" set image deployment/"$deployment" "$container"="$image_ref"
|
|
||||||
kubectl -n "$K8S_NAMESPACE" rollout status deployment/"$deployment" --timeout=15m
|
|
||||||
|
|
||||||
- name: Sync GitOps release
|
- name: Sync GitOps release
|
||||||
env:
|
env:
|
||||||
GITOPS_TOKEN: ${{ secrets.DEPLOY_GITHUB_TOKEN }}
|
GITOPS_TOKEN: ${{ secrets.DEPLOY_GITHUB_TOKEN }}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue