I archived this repository because I think there are now more appropriate options like helm and argocd
This action allows you to deploy to a kubernetes cluster.
Alternatives:
Base64 encoded .kube/config
file, to generate use:
cat .kube/config | base64
kubectl commands output
- name: Kustomize
uses: danielr1996/[email protected]
with:
args: kustomize deployment/overlays/replace > template.yaml
- uses: danielr1996/[email protected]
name: Deploy
with:
kubeconfig: ${{ secrets.KUBE_CONFIG }}
args: apply -f deployment.yaml
- uses: danielr1996/[email protected]
name: Deploy
with:
kubeconfig: ${{ secrets.KUBE_CONFIG }}
args: |
create namespace my-namespace
delete secret -n my-namespace secret-credentials --ignore-not-found
create secret -n my-namespace generic secret-credentials \
--from-literal=USERNAME=${{secrets.USERNAME}} \
--from-literal=PASSWORD=${{secrets.PASSWORD}}
apply -f deployment.yaml
scale_down:
runs-on: [ self-hosted ]
outputs:
replicas: ${{ steps.get_replicas.outputs.output }}
steps:
- name: get replicas count
id: get_replicas
uses: danielr1996/[email protected]
with:
kubeconfig: ${{ secrets.KUBECONFIG }}
args: |
get deployments.apps app -o jsonpath='{.spec.replicas}'
- name: scale down to 0 replicas
uses: danielr1996/[email protected]
with:
kubeconfig: ${{ secrets.KUBECONFIG }}
args: |
scale --replicas=0 deployment app
scale_up:
runs-on: [ self-hosted ]
needs: [ scale_down ]
steps:
- name: create environmental variable
run: |
echo "REPLICAS=${{ needs.scale_down.outputs.replicas }}" | tr -d "'" >> $GITHUB_ENV
- name: scale up to original number of replicas
uses: danielr1996/[email protected]
with:
kubeconfig: ${{ secrets.KUBECONFIG }}
args: |
scale --replicas=${{ env.REPLICAS }} deployment app