42 lines
1.1 KiB
YAML
42 lines
1.1 KiB
YAML
name: Deploy to Kube
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
app-name:
|
|
required: true
|
|
type: string
|
|
app-target:
|
|
required: true
|
|
type: string
|
|
image-tag:
|
|
required: true
|
|
type: string
|
|
secrets:
|
|
REGISTRY:
|
|
required: true
|
|
K8S_CONFIG:
|
|
required: true
|
|
|
|
jobs:
|
|
deploy-k8s:
|
|
name: Deploy
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Deploy
|
|
env:
|
|
K8S_CONFIG: ${{secrets.K8S_CONFIG}}
|
|
REGISTRY: ${{ secrets.REGISTRY }}
|
|
APP: ${{ inputs.app-name }}
|
|
APPTARGET: ${{inputs.app-target}}
|
|
TAG: ${{inputs.image-tag}}
|
|
run: |
|
|
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
|
|
chmod +x kubectl
|
|
mv kubectl /usr/local/bin/
|
|
cd ~
|
|
mkdir .kube
|
|
echo "$K8S_CONFIG" > .kube/config
|
|
kubectl set image deployment/$APP $APPTARGET=$REGISTRY:$TAG
|
|
kubectl rollout restart deployment/$APP
|