35 lines
971 B
YAML
35 lines
971 B
YAML
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: synology
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Log in to Container Registry
|
|
run: echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login ${{ env.REGISTRY }} -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
|
|
|
|
- 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}
|