Skip to content

Deploy on Frontend Development Branch Changes #172

Deploy on Frontend Development Branch Changes

Deploy on Frontend Development Branch Changes #172

name: Deploy on Frontend Development Branch Changes
on:
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Configure Docker to Use Non-HTTPS Registry
run: |
echo '{ "insecure-registries" : ["${{ secrets.DOCKER_REGISTRY }}"] }' | sudo tee /etc/docker/daemon.json
sudo systemctl restart docker
- name: Check Docker Daemon Configuration
run: cat /etc/docker/daemon.json
- name: Build Docker Image
run: |
export DOCKER_BUILDKIT=1
docker build --build-arg VITE_SOCKET_URL=${{ secrets.DEV_VITE_SOCKET_URL }} --build-arg VITE_API_URL=${{ secrets.DEV_VITE_API_URL }} --build-arg VITE_SOCKET_URL_PATH=${{ secrets.DEV_VITE_SOCKET_URL_PATH }} -t ${{ secrets.DOCKER_REGISTRY }}/morak_frontend:${{ github.sha }} -f ./app/frontend/Dockerfile.product .
- name: Push Docker Image to Registry
run: |
docker push ${{ secrets.DOCKER_REGISTRY }}/morak_frontend:${{ github.sha }}
- name: Set up SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H -p ${{ secrets.SSH_PORT }} ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
- name: Deploy to Server
run: |
ssh -p ${{ secrets.SSH_PORT }} ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "
cd morak
./fe-deploy.sh ${{ github.sha }}
"