* web/packages: upgrade next * fix(api/orders): update master validation logic to handle optional masters * fix(api/notify, api/orders): enhance notification messages and update order state handling for masters * fix react typings * refactor(order-buttons, action-panel): streamline button handlers and add return functionality * fix(contacts, orders): replace empty state messages with DataNotFound component for better user feedback * feat(bot): add share bot command and update environment configuration for BOT_URL * fix: pnpm-lock.yaml * feat(bot): implement add contact wizard scene and enhance contact handling logic * feat(profile): add BookContactButton component to enhance booking functionality * fix(order-buttons): update cancel and confirm button logic based on order state * feat(service-select): share services list for all enhance service card display with duration formatting and improve layout
103 lines
3.5 KiB
YAML
103 lines
3.5 KiB
YAML
name: Build & Deploy Web & Bot
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build-and-push:
|
|
name: Build and Push to Docker Hub
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Create fake .env file for build
|
|
run: |
|
|
echo "BOT_TOKEN=fake" > .env
|
|
echo "BOT_URL=fake" > .env
|
|
echo "LOGIN_GRAPHQL=fake" >> .env
|
|
echo "PASSWORD_GRAPHQL=fake" >> .env
|
|
echo "URL_GRAPHQL=http://localhost/graphql" >> .env
|
|
echo "EMAIL_GRAPHQL=fake@example.com" >> .env
|
|
echo "NEXTAUTH_SECRET=fakesecret" >> .env
|
|
|
|
- name: Login to Docker Hub
|
|
run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
|
|
|
|
- name: Build web image
|
|
run: |
|
|
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/zapishis-web:latest -f ./apps/web/Dockerfile .
|
|
|
|
- name: Push web image to Docker Hub
|
|
run: |
|
|
docker push ${{ secrets.DOCKERHUB_USERNAME }}/zapishis-web:latest
|
|
|
|
- name: Build bot image
|
|
run: |
|
|
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/zapishis-bot:latest -f ./apps/bot/Dockerfile .
|
|
|
|
- name: Push bot image to Docker Hub
|
|
run: |
|
|
docker push ${{ secrets.DOCKERHUB_USERNAME }}/zapishis-bot:latest
|
|
|
|
deploy:
|
|
name: Deploy to VPS
|
|
needs: build-and-push
|
|
runs-on: ubuntu-latest
|
|
environment: production
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Setup SSH key
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
echo "${{ secrets.VPS_SSH_KEY }}" > ~/.ssh/id_rsa
|
|
chmod 600 ~/.ssh/id_rsa
|
|
ssh-keyscan -H ${{ secrets.VPS_HOST }} >> ~/.ssh/known_hosts
|
|
|
|
- name: Ensure zapishis directory exists on VPS
|
|
run: |
|
|
ssh -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no ${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }} "mkdir -p /home/${{ secrets.VPS_USER }}/zapishis"
|
|
|
|
- name: Create real .env file for production
|
|
run: |
|
|
echo "BOT_TOKEN=${{ secrets.BOT_TOKEN }}" > .env
|
|
echo "BOT_URL=${{ secrets.BOT_URL }}" > .env
|
|
echo "LOGIN_GRAPHQL=${{ secrets.LOGIN_GRAPHQL }}" >> .env
|
|
echo "PASSWORD_GRAPHQL=${{ secrets.PASSWORD_GRAPHQL }}" >> .env
|
|
echo "URL_GRAPHQL=${{ secrets.URL_GRAPHQL }}" >> .env
|
|
echo "EMAIL_GRAPHQL=${{ secrets.EMAIL_GRAPHQL }}" >> .env
|
|
echo "NEXTAUTH_SECRET=${{ secrets.NEXTAUTH_SECRET }}" >> .env
|
|
|
|
- name: Copy .env to VPS via SCP
|
|
uses: appleboy/scp-action@master
|
|
with:
|
|
host: ${{ secrets.VPS_HOST }}
|
|
username: ${{ secrets.VPS_USER }}
|
|
key: ${{ secrets.VPS_SSH_KEY }}
|
|
port: 22
|
|
source: '.env'
|
|
target: '/home/${{ secrets.VPS_USER }}/zapishis/'
|
|
|
|
- name: Copy docker-compose.yml to VPS via SCP
|
|
uses: appleboy/scp-action@master
|
|
with:
|
|
host: ${{ secrets.VPS_HOST }}
|
|
username: ${{ secrets.VPS_USER }}
|
|
key: ${{ secrets.VPS_SSH_KEY }}
|
|
port: 22
|
|
source: 'docker-compose.yml'
|
|
target: '/home/${{ secrets.VPS_USER }}/zapishis/'
|
|
|
|
- name: Login and deploy on VPS
|
|
run: |
|
|
ssh ${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }} "
|
|
cd /home/${{ secrets.VPS_USER }}/zapishis && \
|
|
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} && \
|
|
docker compose pull && \
|
|
docker compose up -d
|
|
"
|