mirror of
https://github.com/vee1e/workorder-desk.git
synced 2026-09-01 09:50:13 +00:00
ci: add deploy workflow (build linux/amd64 to GHCR + SSH deploy to VPS)
This commit is contained in:
parent
90b01f7414
commit
da4bbebfed
1 changed files with 45 additions and 0 deletions
45
.github/workflows/deploy.yml
vendored
Normal file
45
.github/workflows/deploy.yml
vendored
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
name: deploy
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master, main]
|
||||||
|
paths: [backend/**, packages/**, .github/workflows/deploy.yml]
|
||||||
|
workflow_dispatch:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: docker/setup-buildx-action@v3
|
||||||
|
- uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./backend/Dockerfile
|
||||||
|
target: prod
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: ghcr.io/vee1e/workorders-api:latest
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
deploy:
|
||||||
|
needs: build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: appleboy/ssh-action@v1
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.DEPLOY_HOST }}
|
||||||
|
username: ${{ secrets.DEPLOY_USER }}
|
||||||
|
key: ${{ secrets.DEPLOY_SSH_KEY }}
|
||||||
|
port: 7576
|
||||||
|
script: |
|
||||||
|
cd /srv/personal-apps
|
||||||
|
docker compose pull workorders-api workorders-worker
|
||||||
|
docker compose up -d --no-deps workorders-api workorders-worker
|
||||||
|
docker image prune -f
|
||||||
Loading…
Add table
Add a link
Reference in a new issue