-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (48 loc) · 1.5 KB
/
build-deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: build and deploy
on:
push:
tags:
- v*
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
# repository checkout
- uses: actions/checkout@v2
- name: Set output
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Docker Setup QEMU
uses: docker/setup-qemu-action@v1.2.0
- name: Docker Setup Buildx
uses: docker/setup-buildx-action@v1.6.0
- name: Docker Login
uses: docker/login-action@v1.10.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build Image
working-directory: .
run: docker buildx build --platform linux/amd64,linux/arm64 -t syw5141/khugpt-agent:${{ steps.vars.outputs.tag }} --push .
deploy:
needs: build
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Set output
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Deploy on rpi4 server using docker
uses: appleboy/ssh-action@v1.0.0
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
script: |
cd ~/khugpt-agent-deploy
export KHUGPT_AGENT_IMAGE_TAG=${{ steps.vars.outputs.tag }}
docker-compose pull
docker-compose up --force-recreate --build -d
docker image prune -f