Files
todo3/.gitea/workflows/deploy.yaml
T
luis 0c82c39e60
Build and Deploy / build-deploy (push) Has been cancelled
Serve FE statically
2026-06-05 14:16:55 +01:00

69 lines
1.7 KiB
YAML

name: Build and Deploy
on:
push:
branches: [master]
concurrency:
group: deploy-todo3
cancel-in-progress: false
jobs:
build-deploy:
runs-on: ubuntu-latest
container:
image: docker:latest
volumes:
- /var/www/todo3:/deploy-fe
- /opt/todo3:/deploy
steps:
- name: Install dependencies
run: apk add --no-cache git bash curl nodejs
- name: Install Bun
run: |
curl -fsSL https://bun.sh/install | bash
ln -s /root/.bun/bin/bun /usr/local/bin/bun
- uses: actions/checkout@v4
- name: Install workspace dependencies
run: bun install --frozen-lockfile
- name: Build frontend
run: bun run --filter fe build
env:
PUBLIC_WS_URL: ${{ vars.PUBLIC_WS_URL }}
PUBLIC_BOX_DRAWING_CHARS: ${{ vars.PUBLIC_BOX_DRAWING_CHARS }}
- name: Deploy frontend
run: |
rm -rf /deploy-fe/*
cp -r packages/fe/dist/* /deploy-fe/
- name: Copy source for backend build
run: |
rm -rf /deploy/build
mkdir -p /deploy/build
cp -r . /deploy/build
- name: Create .env file
working-directory: /deploy/build
run: |
cat > .env << 'EOF'
BE_PORT=${{ vars.BE_PORT }}
JWT_SECRET=${{ secrets.JWT_SECRET }}
SIGNUP_SECRET=${{ secrets.SIGNUP_SECRET }}
ADMIN_EMAIL=${{ vars.ADMIN_EMAIL }}
DATA_DIR=/opt/todo3/data
EOF
- name: Build and deploy backend
working-directory: /deploy/build
run: |
docker compose build
docker compose up -d
- name: Cleanup
run: rm -rf /deploy/build