44 lines
1.7 KiB
YAML
44 lines
1.7 KiB
YAML
# Squelette à aligner sur le skill /deploy d'Arthur.
|
|
# - Build images api + pwa
|
|
# - Push vers Gitea Container Registry
|
|
# - kubectl set image (ou apply via kustomize plus tard)
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: pnpm/action-setup@v3
|
|
with: { version: 9 }
|
|
- uses: actions/setup-node@v4
|
|
with: { node-version: 20, cache: pnpm }
|
|
- run: pnpm install --frozen-lockfile
|
|
- run: pnpm -r build
|
|
|
|
- name: Login Gitea Container Registry
|
|
run: echo "${{ secrets.GITEA_TOKEN }}" | docker login gitea.arthurbarre.fr -u ${{ github.actor }} --password-stdin
|
|
|
|
- name: Build & push images
|
|
run: |
|
|
API_TAG=gitea.arthurbarre.fr/arthurbarre/ordinarthur-os-api:${{ github.sha }}
|
|
PWA_TAG=gitea.arthurbarre.fr/arthurbarre/ordinarthur-os-pwa:${{ github.sha }}
|
|
docker build -f apps/api/Dockerfile -t "$API_TAG" .
|
|
docker build -f apps/pwa/Dockerfile -t "$PWA_TAG" .
|
|
docker push "$API_TAG"
|
|
docker push "$PWA_TAG"
|
|
echo "API_TAG=$API_TAG" >> $GITHUB_ENV
|
|
echo "PWA_TAG=$PWA_TAG" >> $GITHUB_ENV
|
|
|
|
- name: Deploy on k3s
|
|
env:
|
|
KUBECONFIG_DATA: ${{ secrets.KUBECONFIG }}
|
|
run: |
|
|
mkdir -p ~/.kube && echo "$KUBECONFIG_DATA" | base64 -d > ~/.kube/config
|
|
kubectl -n ordinarthur-os set image deploy/api api=$API_TAG
|
|
kubectl -n ordinarthur-os set image deploy/pwa pwa=$PWA_TAG
|
|
kubectl -n ordinarthur-os rollout status deploy/api --timeout=120s
|
|
kubectl -n ordinarthur-os rollout status deploy/pwa --timeout=120s
|