mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-01 23:56:39 +08:00
add test build
This commit is contained in:
parent
80414b3336
commit
1780e9a623
58
.github/workflows/dockerToHub.yml
vendored
58
.github/workflows/dockerToHub.yml
vendored
@ -10,29 +10,55 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: build image
|
name: build image
|
||||||
#runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
runs-on: chengdu
|
#runs-on: chengdu
|
||||||
steps:
|
steps:
|
||||||
- name: Check out the repo
|
- name: Check out the repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
#with:
|
||||||
|
# clean: false
|
||||||
|
- name: Set up SSH key
|
||||||
|
uses: webfactory/ssh-agent@v0.9.0
|
||||||
with:
|
with:
|
||||||
clean: false
|
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
github-server-url: 'https://gh.sivpn.cn'
|
- name: Sync repository to nm
|
||||||
- name: build and deploy to Docker Hub
|
|
||||||
run: |
|
run: |
|
||||||
echo ${{ secrets.DOCKER_PASSWORD }} | docker login registry.si.icu -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
|
|
||||||
echo "${{ secrets.DOCKER_ENV }}" > .env
|
echo "${{ secrets.DOCKER_ENV }}" > .env
|
||||||
- name: Get current date
|
ssh -o StrictHostKeyChecking=no -p${{ secrets.SSH_PORT }} root@${{ secrets.CHENGDU_SSH_IP }} 'mkdir -p /data/ChatGPT-Next-Web'
|
||||||
run: echo "DATE_TAG=$(date +'%Y%m%d')" >> $GITHUB_ENV
|
rsync -az -e 'ssh -o StrictHostKeyChecking=no -p${{ secrets.SSH_PORT }}' --delete $GITHUB_WORKSPACE/ root@${{ secrets.CHENGDU_SSH_IP }}:/data/ChatGPT-Next-Web/
|
||||||
- name: Build and push Docker image
|
# - name: build and deploy to Docker Hub
|
||||||
uses: docker/build-push-action@v4
|
# run: |
|
||||||
|
# echo ${{ secrets.DOCKER_PASSWORD }} | docker login registry.si.icu -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
|
||||||
|
- name: build-by-chengdu
|
||||||
|
uses: appleboy/ssh-action@master
|
||||||
|
env:
|
||||||
|
SERVER_WORKDIR: ${{ secrets.SERVER_WORKDIR }} #传递工作目录变量
|
||||||
with:
|
with:
|
||||||
context: .
|
host: ${{ secrets.CHENGDU_SSH_IP }} #服务器地址
|
||||||
push: true
|
username: root #用户名
|
||||||
no-cache: true
|
port: ${{ secrets.SSH_PORT }}
|
||||||
tags: |
|
key: ${{ secrets.SSH_PRIVATE_KEY }} #私钥 安全问题一定都以变量的方式传递!!!
|
||||||
registry.si.icu/sijinhui/chatgpt-next-web:latest
|
envs: SERVER_WORKDIR #使用工作目录变量
|
||||||
registry.si.icu/sijinhui/chatgpt-next-web:${{ env.DATE_TAG }}
|
script: |
|
||||||
|
cd $SERVER_WORKDIR #进入到工作目录
|
||||||
|
IMAGE_NAME="registry.si.icu/sijinhui/chatgpt-next-web"
|
||||||
|
DATE_TAG=$(date +'%Y%m%d')
|
||||||
|
# 构建 Docker 镜像并推送到注册表
|
||||||
|
docker build --no-cache -t ${IMAGE_NAME}:latest .
|
||||||
|
docker tag ${IMAGE_NAME}:latest ${IMAGE_NAME}:${DATE_TAG}
|
||||||
|
docker push ${IMAGE_NAME}:latest
|
||||||
|
docker push ${IMAGE_NAME}:${DATE_TAG}
|
||||||
|
# - name: Get current date
|
||||||
|
# run: echo "DATE_TAG=$(date +'%Y%m%d')" >> $GITHUB_ENV
|
||||||
|
# - name: Build and push Docker image
|
||||||
|
# uses: docker/build-push-action@v4
|
||||||
|
# with:
|
||||||
|
# context: .
|
||||||
|
# push: true
|
||||||
|
# no-cache: true
|
||||||
|
# tags: |
|
||||||
|
# registry.si.icu/sijinhui/chatgpt-next-web:latest
|
||||||
|
# registry.si.icu/sijinhui/chatgpt-next-web:${{ env.DATE_TAG }}
|
||||||
# - name: clean build history
|
# - name: clean build history
|
||||||
# run: |
|
# run: |
|
||||||
# yes | docker system prune --filter "until=720h"
|
# yes | docker system prune --filter "until=720h"
|
||||||
|
Loading…
Reference in New Issue
Block a user