Merge pull request #1040 from 5sControl/feat/1029-add-email-password-… #229
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: DEVELOPMENT build and deploy front mobile | |
env: | |
DOCKERHUB_USERNAME: ${{ vars.DOCKERHUB_USERNAME }} | |
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | |
ACTIONS_STEP_DEBUG: true | |
on: | |
push: | |
branches: | |
- development | |
paths: | |
- 'mobile/**' | |
- '.github/workflows/dev-mobile.yml' | |
jobs: | |
Build: | |
runs-on: self-hosted-dev | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Get the short Git commit hash | |
id: vars | |
run: | | |
echo "COMMIT_HASH=${GITHUB_SHA::7}" >> $GITHUB_ENV | |
- name: Get metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: 5scontrol/5scontrol_front_mobile | |
tags: | | |
"${{ env.COMMIT_HASH }}" | |
latest | |
continue-on-error: false | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ env.DOCKERHUB_USERNAME }} | |
password: ${{ env.DOCKERHUB_TOKEN }} | |
continue-on-error: false | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./mobile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=registry,ref=5scontrol/5scontrol_front_mobile:cache | |
cache-to: type=registry,ref=5scontrol/5scontrol_front_mobile:cache,mode=max | |
continue-on-error: false | |
env: | |
DOCKER_BUILDKIT: 1 | |
Deploy: | |
runs-on: self-hosted-dev | |
needs: Build | |
steps: | |
- name: Pull the latest Docker image | |
working-directory: /home/server/reps/server- | |
run: | | |
echo "Pulling latest Docker image for 5scontrol_front_mobile..." | |
docker-compose pull 5scontrol_front_mobile | |
- name: Stop and remove the old server container | |
working-directory: /home/server/reps/server- | |
run: | | |
echo "Stopping and removing the old 5scontrol_front_mobile and nginx container..." | |
docker-compose rm -fs nginx 5scontrol_front_mobile | |
- name: Recreate and restart server container | |
working-directory: /home/server/reps/server- | |
run: | | |
echo "Recreating and restarting the 5scontrol_front_mobile and nginx container..." | |
docker-compose up -d --no-deps nginx 5scontrol_front_mobile |