From 31fbb6c2605922cdc249fa90135c55ccef103b46 Mon Sep 17 00:00:00 2001 From: WMJ Ismail Date: Mon, 6 Jul 2026 23:49:02 +0200 Subject: [PATCH] ci: add Gitea Actions workflow for build & deploy Adds CI/CD pipeline that: - Builds Docker image on push to staging branch - Pushes to GHCR - Deploys to Swarm service --- .gitea/workflows/build-deploy.yml | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .gitea/workflows/build-deploy.yml diff --git a/.gitea/workflows/build-deploy.yml b/.gitea/workflows/build-deploy.yml new file mode 100644 index 0000000..ce8f4ba --- /dev/null +++ b/.gitea/workflows/build-deploy.yml @@ -0,0 +1,38 @@ +name: Build & Deploy Mobile +on: + push: + branches: + - staging + +env: + REGISTRY: ghcr.io + IMAGE_NAME: maifors/falah-mobile + SWARM_SERVICE: falah_falah-mobile + +jobs: + build-and-deploy: + runs-on: contabo + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Log in to Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: Build and Push Docker Image + run: | + IMAGE_TAG="${REGISTRY}/${IMAGE_NAME}:staging-${GITHUB_SHA::7}" + docker build -t ${IMAGE_TAG} -t ${REGISTRY}/${IMAGE_NAME}:staging . + docker push ${IMAGE_TAG} + docker push ${REGISTRY}/${IMAGE_NAME}:staging + + - name: Deploy to Swarm + run: | + docker service update \ + --image ${REGISTRY}/${IMAGE_NAME}:staging \ + --with-registry-auth \ + ${SWARM_SERVICE}