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}