Skip to content

Commit

Permalink
feat(cicd):inpl
Browse files Browse the repository at this point in the history
  • Loading branch information
arc0035 committed Nov 1, 2023
1 parent 1264f18 commit f7212cc
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
53 changes: 53 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Official Backend CICD

on:
push:
# 分支
branches: [ main ]
pull_request_target:
branches: [ main ]
types: [closed]


jobs:
build:
if: |
github.event.pull_request.merged == true ||
github.event_name == 'push'
runs-on: ubuntu-latest
name: Building background
steps:
- run: |
echo Build is triggered
- uses: actions/checkout@v2 #拉取项目文件
- name: Set up JDK 8 #配置java环境
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
- name: Grant execute permission for gradlew #更改脚本权限
run: chmod +x gradlew
- name: Build with Gradle #开始打包 -x test 跳过测试
run: ./gradlew jar -x test
- name: Copy folder content recursively to remote
uses: garygrossgarten/github-action-scp@release
with:
- local: dist
remote: "/root/Dapp-Learning-Official-web"
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }} # 服务器ssh端口(默认22)
- name: deploy_app #开始部署
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }} #服务器ip地址
username: ${{ secrets.USERNAME }} #服务器ssh用户名
password: ${{ secrets.PASSWORD }} #服务器ssh密码
port: ${{ secrets.PORT }} # 服务器ssh端口(默认22)
script: |
cd /root/Dapp-Learning-Official-web/dist
export DBPWD=${{secrets.SPRING_DATASOURCE_PASSWORD}}
sed 's/${SPRING_DATASOURCE_PASSWORD}/$DBPWD/g' conf/application.yml >> conf/application.yml
bash stop.sh
bash start.sh
Loading

0 comments on commit f7212cc

Please sign in to comment.