aria: scaffold .gitea/workflows/deploy.yml
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 16s
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 16s
This commit is contained in:
parent
141f986b75
commit
81b84b190c
62
.gitea/workflows/deploy.yml
Normal file
62
.gitea/workflows/deploy.yml
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
name: Build & Deploy
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: git.arthurbarre.fr
|
||||||
|
IMAGE: ordinarthur/dolphinsite
|
||||||
|
NAMESPACE: aria-projects
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Login to Gitea Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ordinarthur
|
||||||
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
${{ env.REGISTRY }}/${{ env.IMAGE }}:latest
|
||||||
|
${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ github.sha }}
|
||||||
|
|
||||||
|
- name: Install kubectl
|
||||||
|
run: |
|
||||||
|
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: Deploy to K3s
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.kube
|
||||||
|
echo "${{ secrets.KUBECONFIG }}" | base64 -d > ~/.kube/config
|
||||||
|
chmod 600 ~/.kube/config
|
||||||
|
|
||||||
|
kubectl apply -f k8s/namespace.yml
|
||||||
|
|
||||||
|
kubectl -n $NAMESPACE create secret docker-registry gitea-registry \
|
||||||
|
--docker-server=$REGISTRY \
|
||||||
|
--docker-username=ordinarthur \
|
||||||
|
--docker-password=${{ secrets.REGISTRY_PASSWORD }} \
|
||||||
|
--dry-run=client -o yaml | kubectl apply -f -
|
||||||
|
|
||||||
|
kubectl apply -f k8s/deployment.yml
|
||||||
|
kubectl apply -f k8s/service.yml
|
||||||
|
|
||||||
|
kubectl -n $NAMESPACE set image deployment/dolphinsite \
|
||||||
|
dolphinsite=${{ env.REGISTRY }}/${{ env.IMAGE }}:${{ github.sha }}
|
||||||
|
|
||||||
|
kubectl -n $NAMESPACE rollout status deployment/dolphinsite --timeout=120s
|
||||||
Loading…
x
Reference in New Issue
Block a user