Skip to content

Workflow report

Workflow report #22

Workflow file for this run

name: Deploy
on:
push:
branches:
- main
workflow_dispatch:
env:
SERVER_USER: ${{ vars.SERVER_USER }}
SERVER_HOST: ${{ vars.SERVER_HOST }}
SERVER_DIR: ${{ vars.SERVER_DIR }}
jobs:
build:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build on github
run: docker compose build
build-and-run:
runs-on: self-hosted
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Auth SSH
uses: ./.github/.actions/ssh_auth
- name: Sync with server
run: rsync -avz --exclude='.env' ./ ${{ vars.SERVER_USER }}@${{ vars.SERVER_HOST }}:${{ vars.SERVER_DIR }}
- name: Build
run: |
ssh $SERVER_USER@$SERVER_HOST << EOF
cd $SERVER_DIR
docker compose build
EOF
- name: Run
run: |
ssh $SERVER_USER@$SERVER_HOST << EOF
cd $SERVER_DIR
docker compose up -d
EOF
- name: Download report req
run: pip install -r ./utils/requirements.txt
- name: Send report
env:
TG_TOKEN: ${{ secrets.TG_TOKEN }}
TG_CHAT_ID: ${{ vars.TG_CHAT_ID }}
run: python3 ./utils/send_result.py success
fail-report:
runs-on: self-hosted
if: failure()
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Auth SSH
uses: ./.github/.actions/ssh_auth
- name: Download report req
run: pip install -r ./utils/requirements.txt
- name: Send report
env:
TG_TOKEN: ${{ secrets.TG_TOKEN }}
TG_CHAT_ID: ${{ vars.TG_CHAT_ID }}
run: python3 ./utils/send_result.py fail