Files
TakeoutSaaS.AdminApi/.gitea/workflows/deploy.yml

44 lines
1.4 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: Build and Deploy AdminApi
on:
push:
branches:
- dev
jobs:
build-and-deploy:
runs-on: host
steps:
- name: Checkout code
run: |
rm -rf /opt/deploy/adminapi || true
mkdir -p /opt/deploy/adminapi
cd /opt/deploy/adminapi
git clone --depth 1 --branch dev ssh://git@git.laosankeji.com:2222/msumshk/TakeoutSaaS.AdminApi.git .
# 手动拉取 submodules从 Gitea 而不是 GitHub
git submodule init
git config submodule.TakeoutSaaS.BuildingBlocks.url ssh://git@git.laosankeji.com:2222/msumshk/TakeoutSaaS.BuildingBlocks.git
git config submodule.TakeoutSaaS.Docs.url ssh://git@git.laosankeji.com:2222/msumshk/TakeoutSaaS.Docs.git
git submodule update --depth 1
- name: Build Docker image
run: |
cd /opt/deploy/adminapi
docker build -t takeoutsaas-adminapi:latest -f src/Api/TakeoutSaaS.AdminApi/Dockerfile .
- name: Deploy container
run: |
docker stop adminapi || true
docker rm adminapi || true
docker run -d \
--name adminapi \
--restart unless-stopped \
-p 7801:7801 \
-e ASPNETCORE_ENVIRONMENT=Production \
takeoutsaas-adminapi:latest
- name: Clean up old images
run: |
docker image prune -f