diff --git a/.forgejo/workflows/build-and-deploy.yaml b/.forgejo/workflows/build-and-deploy.yaml new file mode 100644 index 0000000..29c4a10 --- /dev/null +++ b/.forgejo/workflows/build-and-deploy.yaml @@ -0,0 +1,31 @@ +name: Build and Deploy + +on: + push: + branches: + - main + - dev + - 'feat/**' + - 'test/**' + - 'fix/**' + - 'hotfix/**' + +env: + IMAGE: git.avisenna-engineering.de/keyvan/avisenna-landing-page + VERSION: latest + NAMESPACE: ${{ github.ref == 'refs/heads/main' && 'prod' || 'web' }} + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Build Docker image + run: docker build -t $IMAGE:$VERSION . + + - name: Deploy to Kubernetes + run: | + kubectl set image deployment/homepage homepage=$IMAGE:$VERSION -n $NAMESPACE + kubectl rollout restart deployment/homepage -n $NAMESPACE