use gh token
This commit is contained in:
parent
cab41db529
commit
190238cc4c
1 changed files with 14 additions and 2 deletions
16
.github/workflows/build-and-deploy.yaml
vendored
16
.github/workflows/build-and-deploy.yaml
vendored
|
|
@ -41,8 +41,20 @@ jobs:
|
||||||
echo "${{ secrets.KUBECONFIG_BASE64 }}" | base64 -d > $HOME/.kube/config
|
echo "${{ secrets.KUBECONFIG_BASE64 }}" | base64 -d > $HOME/.kube/config
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
|
- name: Detect container name
|
||||||
|
id: detect-container
|
||||||
|
run: |
|
||||||
|
CONTAINER=$(kubectl -n $NAMESPACE get deployment homepage -o=jsonpath='{.spec.template.spec.containers[0].name}')
|
||||||
|
echo "container=$CONTAINER" >> $GITHUB_OUTPUT
|
||||||
|
env:
|
||||||
|
NAMESPACE: ${{ github.ref == 'refs/heads/main' && 'prod' || 'web' }}
|
||||||
|
|
||||||
- name: Deploy to Kubernetes
|
- name: Deploy to Kubernetes
|
||||||
run: |
|
run: |
|
||||||
IMAGE="ghcr.io/${{ github.repository }}:$VERSION"
|
IMAGE="ghcr.io/${{ github.repository }}:$VERSION"
|
||||||
kubectl set image deployment/homepage home=$IMAGE -n $NAMESPACE
|
CONTAINER="${{ steps.detect-container.outputs.container }}"
|
||||||
shell: bash
|
echo "Deploying $CONTAINER with image $IMAGE to $NAMESPACE"
|
||||||
|
kubectl set image deployment/homepage $CONTAINER=$IMAGE -n $NAMESPACE
|
||||||
|
env:
|
||||||
|
VERSION: ${{ vars.VERSION || 'latest' }}
|
||||||
|
NAMESPACE: ${{ github.ref == 'refs/heads/main' && 'prod' || 'web' }}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue