Migration CI GitLab -> Gitea Actions
This commit is contained in:
@@ -0,0 +1,44 @@
|
|||||||
|
name: build-and-deploy
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main, master]
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE: git.valentin-massonniere.ch/${{ github.repository }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Login registry Gitea
|
||||||
|
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login git.valentin-massonniere.ch -u "${{ secrets.REGISTRY_USER }}" --password-stdin
|
||||||
|
|
||||||
|
- name: Build & push
|
||||||
|
run: |
|
||||||
|
docker build -t "$IMAGE:${{ github.sha }}" -t "$IMAGE:latest" .
|
||||||
|
docker push "$IMAGE:${{ github.sha }}"
|
||||||
|
docker push "$IMAGE:latest"
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
needs: build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Installer kubectl
|
||||||
|
run: |
|
||||||
|
curl -sLO "https://dl.k8s.io/release/$(curl -sL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
|
||||||
|
chmod +x kubectl && sudo mv kubectl /usr/local/bin/
|
||||||
|
|
||||||
|
- name: Configurer kubeconfig
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.kube
|
||||||
|
echo "${{ secrets.KUBE_CONFIG }}" | base64 -d > ~/.kube/config
|
||||||
|
chmod 600 ~/.kube/config
|
||||||
|
|
||||||
|
- name: Déployer le Portfolio
|
||||||
|
run: |
|
||||||
|
kubectl apply -f k8s.yaml
|
||||||
|
kubectl rollout restart deployment/portfolio-app -n portfolio-ns
|
||||||
Reference in New Issue
Block a user