64 lines
1.4 KiB
YAML
64 lines
1.4 KiB
YAML
name: Build and Deploy
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
|
|
concurrency:
|
|
group: deploy-coins
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
build-deploy:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: docker:latest
|
|
volumes:
|
|
- /var/www/coins:/deploy-fe
|
|
- /opt/coins:/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 build
|
|
|
|
- name: Deploy frontend
|
|
run: |
|
|
rm -rf /deploy-fe/*
|
|
cp -r 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'
|
|
HOST_PORT=${{ vars.HOST_PORT }}
|
|
DATA_DIR=/opt/coins/data
|
|
NUMISTA_API_KEY=${{ secrets.NUMISTA_API_KEY }}
|
|
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
|