ci(other): update cicd
This commit is contained in:
@@ -19,14 +19,13 @@ jobs:
|
|||||||
- name: Install Git
|
- name: Install Git
|
||||||
run: |
|
run: |
|
||||||
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||||
apk add --no-cache git
|
apk add --no-cache git openssh-client sshpass curl
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: https://gitea.com/actions/checkout@v4
|
uses: https://gitea.com/actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup environment
|
- name: Setup environment
|
||||||
run: |
|
run: |
|
||||||
apk add --no-cache curl
|
|
||||||
npm config set registry https://registry.npmmirror.com/
|
npm config set registry https://registry.npmmirror.com/
|
||||||
corepack enable && corepack prepare pnpm@8 --activate
|
corepack enable && corepack prepare pnpm@8 --activate
|
||||||
|
|
||||||
@@ -39,27 +38,18 @@ jobs:
|
|||||||
- name: Pack artifacts
|
- name: Pack artifacts
|
||||||
run: tar -zcf dist.tar ./dist ./default.conf ./Dockerfile
|
run: tar -zcf dist.tar ./dist ./default.conf ./Dockerfile
|
||||||
|
|
||||||
- name: Upload to server
|
- name: Upload and Deploy
|
||||||
uses: docker://appleboy/scp-action:v0.1.7
|
env:
|
||||||
with:
|
HOST: ${{ secrets.HOST_DEV }}
|
||||||
host: ${{ secrets.HOST_DEV }}
|
USER: ${{ secrets.USER_DEV }}
|
||||||
username: ${{ secrets.USER_DEV }}
|
PWD: ${{ secrets.PWD_DEV }}
|
||||||
password: ${{ secrets.PWD_DEV }}
|
run: |
|
||||||
port: 22
|
sshpass -p "$PWD" scp -o StrictHostKeyChecking=no -P 22 dist.tar ${USER}@${HOST}:/www/builder/
|
||||||
source: dist.tar
|
sshpass -p "$PWD" ssh -o StrictHostKeyChecking=no -p 22 ${USER}@${HOST} << 'ENDSSH'
|
||||||
target: /www/builder
|
|
||||||
|
|
||||||
- name: Deploy
|
|
||||||
uses: docker://appleboy/ssh-action:v1.0.3
|
|
||||||
with:
|
|
||||||
host: ${{ secrets.HOST_DEV }}
|
|
||||||
username: ${{ secrets.USER_DEV }}
|
|
||||||
password: ${{ secrets.PWD_DEV }}
|
|
||||||
port: 22
|
|
||||||
envs: APP_NAME,APP_PORT
|
|
||||||
script: |
|
|
||||||
set -e
|
set -e
|
||||||
cd /www/builder
|
cd /www/builder
|
||||||
|
APP_NAME=jdt-mer-dev
|
||||||
|
APP_PORT=8083
|
||||||
rm -rf $APP_NAME && mkdir -p $APP_NAME
|
rm -rf $APP_NAME && mkdir -p $APP_NAME
|
||||||
tar -xzf dist.tar -C $APP_NAME && rm -f dist.tar
|
tar -xzf dist.tar -C $APP_NAME && rm -f dist.tar
|
||||||
cd $APP_NAME
|
cd $APP_NAME
|
||||||
@@ -67,6 +57,7 @@ jobs:
|
|||||||
docker rm -f $APP_NAME 2>/dev/null || true
|
docker rm -f $APP_NAME 2>/dev/null || true
|
||||||
docker run -d -p $APP_PORT:80 --restart=always --name $APP_NAME $APP_NAME
|
docker run -d -p $APP_PORT:80 --restart=always --name $APP_NAME $APP_NAME
|
||||||
cd .. && rm -rf $APP_NAME
|
cd .. && rm -rf $APP_NAME
|
||||||
|
ENDSSH
|
||||||
|
|
||||||
- name: Notify WeCom
|
- name: Notify WeCom
|
||||||
if: always()
|
if: always()
|
||||||
@@ -97,14 +88,13 @@ jobs:
|
|||||||
- name: Install Git
|
- name: Install Git
|
||||||
run: |
|
run: |
|
||||||
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||||
apk add --no-cache git
|
apk add --no-cache git openssh-client sshpass curl
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: https://gitea.com/actions/checkout@v4
|
uses: https://gitea.com/actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup environment
|
- name: Setup environment
|
||||||
run: |
|
run: |
|
||||||
apk add --no-cache curl
|
|
||||||
npm config set registry https://registry.npmmirror.com/
|
npm config set registry https://registry.npmmirror.com/
|
||||||
corepack enable && corepack prepare pnpm@8 --activate
|
corepack enable && corepack prepare pnpm@8 --activate
|
||||||
|
|
||||||
@@ -117,27 +107,18 @@ jobs:
|
|||||||
- name: Pack artifacts
|
- name: Pack artifacts
|
||||||
run: tar -zcf dist.tar ./dist ./default.conf ./Dockerfile
|
run: tar -zcf dist.tar ./dist ./default.conf ./Dockerfile
|
||||||
|
|
||||||
- name: Upload to server
|
- name: Upload and Deploy
|
||||||
uses: docker://appleboy/scp-action:v0.1.7
|
env:
|
||||||
with:
|
HOST: ${{ secrets.HOST_PROD }}
|
||||||
host: ${{ secrets.HOST_PROD }}
|
USER: ${{ secrets.USER_PROD }}
|
||||||
username: ${{ secrets.USER_PROD }}
|
PWD: ${{ secrets.PWD_PROD }}
|
||||||
password: ${{ secrets.PWD_PROD }}
|
run: |
|
||||||
port: 22
|
sshpass -p "$PWD" scp -o StrictHostKeyChecking=no -P 22 dist.tar ${USER}@${HOST}:/www/builder/
|
||||||
source: dist.tar
|
sshpass -p "$PWD" ssh -o StrictHostKeyChecking=no -p 22 ${USER}@${HOST} << 'ENDSSH'
|
||||||
target: /www/builder
|
|
||||||
|
|
||||||
- name: Deploy
|
|
||||||
uses: docker://appleboy/ssh-action:v1.0.3
|
|
||||||
with:
|
|
||||||
host: ${{ secrets.HOST_PROD }}
|
|
||||||
username: ${{ secrets.USER_PROD }}
|
|
||||||
password: ${{ secrets.PWD_PROD }}
|
|
||||||
port: 22
|
|
||||||
envs: APP_NAME,APP_PORT
|
|
||||||
script: |
|
|
||||||
set -e
|
set -e
|
||||||
cd /www/builder
|
cd /www/builder
|
||||||
|
APP_NAME=jdt-mer-prod
|
||||||
|
APP_PORT=8083
|
||||||
rm -rf $APP_NAME && mkdir -p $APP_NAME
|
rm -rf $APP_NAME && mkdir -p $APP_NAME
|
||||||
tar -xzf dist.tar -C $APP_NAME && rm -f dist.tar
|
tar -xzf dist.tar -C $APP_NAME && rm -f dist.tar
|
||||||
cd $APP_NAME
|
cd $APP_NAME
|
||||||
@@ -145,6 +126,7 @@ jobs:
|
|||||||
docker rm -f $APP_NAME 2>/dev/null || true
|
docker rm -f $APP_NAME 2>/dev/null || true
|
||||||
docker run -d -p $APP_PORT:80 --restart=always --name $APP_NAME $APP_NAME
|
docker run -d -p $APP_PORT:80 --restart=always --name $APP_NAME $APP_NAME
|
||||||
cd .. && rm -rf $APP_NAME
|
cd .. && rm -rf $APP_NAME
|
||||||
|
ENDSSH
|
||||||
|
|
||||||
- name: Notify WeCom
|
- name: Notify WeCom
|
||||||
if: always()
|
if: always()
|
||||||
|
|||||||
Reference in New Issue
Block a user