Ajouter .forgejo / workflows / deploy.yml
This commit is contained in:
commit
665fb06e75
1 changed files with 45 additions and 0 deletions
45
.forgejo / workflows / deploy.yml
Normal file
45
.forgejo / workflows / deploy.yml
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
name: Deploy to Kubernetes
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy-to-k8s:
|
||||||
|
runs-on: docker
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout du code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Installer kubectl
|
||||||
|
run: |
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y curl
|
||||||
|
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
|
||||||
|
chmod +x kubectl
|
||||||
|
mv kubectl /usr/local/bin/
|
||||||
|
|
||||||
|
- name: Déployer sur Kubernetes
|
||||||
|
uses: docker://bitnami/kubectl:latest
|
||||||
|
env:
|
||||||
|
KUBECONFIG_DATA: ${{ secrets.KUBECONFIG_DATA }}
|
||||||
|
IMAGE_NAME: grafana/grafana
|
||||||
|
with:
|
||||||
|
entrypoint: /bin/sh
|
||||||
|
args: |
|
||||||
|
-c "
|
||||||
|
# Nettoyer les retours à la ligne et les caractères spéciaux
|
||||||
|
#cat <<EOF > /tmp/kubeconfig.yaml
|
||||||
|
#$KUBECONFIG_DATA
|
||||||
|
#EOF
|
||||||
|
cp kubeconfig.yaml > /tmp/kubeconfig.yaml &&
|
||||||
|
#echo "$KUBECONFIG_DATA" > /tmp/kubeconfig.yaml &&
|
||||||
|
export KUBECONFIG=/tmp/kubeconfig.yaml &&
|
||||||
|
kubectl config view --raw &&
|
||||||
|
cat /tmp/kubeconfig.yaml &&
|
||||||
|
kubectl get pods &&
|
||||||
|
kubectl set image deployment/grafana grafana=${IMAGE_NAME}:${GITHUB_REF_NAME} &&
|
||||||
|
kubectl rollout status deployment/grafana
|
||||||
|
"
|
||||||
Loading…
Reference in a new issue