mirror of
https://github.com/fromchat-messenger/web.git
synced 2026-09-22 19:15:08 +03:00
57 lines
1.6 KiB
YAML
57 lines
1.6 KiB
YAML
# Simple workflow for deploying to the self-hosted server
|
|
name: Deploy to server
|
|
|
|
on:
|
|
# Runs on pushes targeting the default branch
|
|
push:
|
|
branches: ["main"]
|
|
paths:
|
|
- "backend/**"
|
|
- "frontend/**"
|
|
- "deployment/**"
|
|
- "**/package.json"
|
|
- ".nvmrc"
|
|
- ".github/workflows/deploy.yml"
|
|
- "!frontend/electron/**"
|
|
- "!frontend/src/electron/**"
|
|
- "!**.d.ts"
|
|
workflow_dispatch:
|
|
|
|
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
|
|
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
|
|
concurrency:
|
|
group: "pages"
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: self-hosted
|
|
env:
|
|
HOME: "/root"
|
|
environment:
|
|
name: production
|
|
url: https://fromchat.toolbox-io.ru
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Set up environment
|
|
run: |
|
|
mkdir -p deployment
|
|
touch deployment/.env
|
|
cat > deployment/.env << EOF
|
|
JWT_SECRET=${{ secrets.JWT_SECRET }}
|
|
EOF
|
|
- name: Build container
|
|
run: |
|
|
cd deployment
|
|
docker compose build
|
|
- name: Set up the service
|
|
run: |
|
|
cp -f deployment/fromchat.service /etc/systemd/system/fromchat.service
|
|
systemctl daemon-reload
|
|
- name: Start the server
|
|
run: |
|
|
if ! systemctl restart fromchat && sleep 10 && systemctl status fromchat; then
|
|
journalctl --no-pager -xeu fromchat
|
|
exit 1
|
|
fi |