2024-03-21 15:29:19 +08:00
|
|
|
name: CI
|
|
|
|
run-name: ${{ gitea.actor }} is testing out Gitea Actions
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- local-test
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
Docker-Build:
|
|
|
|
runs-on: joylink-local233
|
|
|
|
steps:
|
|
|
|
- name: 检出代码
|
|
|
|
uses: https://gitea.joylink.club/actions/checkout@v4
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
- name: 设置java环境
|
2024-03-21 15:33:20 +08:00
|
|
|
uses: https://gitea.joylink.club/actions/setup-java@v4
|
2024-03-21 15:29:19 +08:00
|
|
|
with:
|
|
|
|
java-version: '11'
|
|
|
|
distribution: 'zulu'
|
|
|
|
cache: 'maven'
|
|
|
|
cache-dependency-path: './pom.xml'
|
2024-03-22 09:33:00 +08:00
|
|
|
- name: 设置Maven环境
|
2024-03-22 15:37:25 +08:00
|
|
|
uses: https://gitea.joylink.club/actions/local-setup-maven@v0.1.1
|
2024-03-22 09:33:00 +08:00
|
|
|
with:
|
2024-03-22 15:37:25 +08:00
|
|
|
maven-version: 3.8.8
|
2024-03-21 15:29:19 +08:00
|
|
|
- name: 构建
|
|
|
|
run: |
|
|
|
|
mvn -Dmaven.test.skip=true clean package
|
|
|
|
- name: 设置 Docker
|
|
|
|
uses: https://gitea.joylink.club/actions/local-setup-docker-cli-action@v0.1.1
|
|
|
|
- name: 设置 Docker Buildx
|
|
|
|
uses: https://gitea.joylink.club/actions/local-setup-buildx-action@v0.1.3
|
|
|
|
- name: docker登录gitea.joylink.club
|
|
|
|
uses: https://gitea.joylink.club/docker/login-action@v3
|
|
|
|
with:
|
|
|
|
registry: gitea.joylink.club
|
|
|
|
username: shengxuqiang
|
|
|
|
password: ${{ secrets.SHENGXUQIANG_PASSWORD }}
|
|
|
|
- name: Docker Build and push
|
|
|
|
uses: https://gitea.joylink.club/docker/build-push-action@v5
|
|
|
|
with:
|
|
|
|
context: .
|
2024-03-22 15:37:25 +08:00
|
|
|
file: ./Dockerfile
|
2024-03-21 15:29:19 +08:00
|
|
|
push: true
|
|
|
|
tags: |
|
|
|
|
gitea.joylink.club/joylink/rt-sim-training-service:local-test
|
|
|
|
- name: 发布到本地测试环境
|
|
|
|
uses: https://gitea.joylink.club/appleboy/ssh-action@v1.0.3
|
|
|
|
with:
|
|
|
|
host: ${{ secrets.LOCAL_233_SSH_HOST }}
|
|
|
|
port: ${{ secrets.LOCAL_233_SSH_PORT }}
|
|
|
|
username: ${{ secrets.LOCAL_233_SSH_USER }}
|
|
|
|
password: ${{ secrets.LOCAL_233_SSH_PASSWORD }}
|
|
|
|
script: |
|
|
|
|
docker rm -f rt-sim-training-service || echo "rt-sim-training-service not exist"
|
|
|
|
docker pull gitea.joylink.club/joylink/rt-sim-training-service:local-test
|
2024-03-25 18:19:31 +08:00
|
|
|
docker run --name rt-sim-training-service --restart=always --network net --ip 192.168.53.3 -d -e APP_ENV=local-test -p 9000:9000 -p 19000:19000 -v /usr/local/joylink/logs/rtss:/usr/local/joylink/logs/rtss gitea.joylink.club/joylink/rt-sim-training-service:local-test
|
|
|
|
- name: 清理tag为none的镜像
|
|
|
|
run: |
|
|
|
|
docker rmi $(docker images --filter "dangling=true" -q)
|