-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: iot-gateway ali_自动部署 | ||
on: | ||
push: | ||
branches: ["main","develop"] | ||
pull_request: | ||
branches: ["main","develop"] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
develop_build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 拉取最新提交的代码 | ||
uses: actions/checkout@v3 | ||
|
||
- name: 设置jdk | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'zulu' | ||
java-version: '17' | ||
cache: 'maven' | ||
|
||
- name: 项目打包 | ||
run: mvn clean -DskipTests=true -B package | ||
|
||
- name: 删除旧的jar包以及运行脚本 | ||
run: sshpass -p ${{secrets.REMOTE_PWD_V}} ssh -o StrictHostKeyChecking=no root@${{secrets.REMOTE_IP_V}} "cd /my/iot-gateway && rm -rf ./*" | ||
|
||
- name: 上传jar包和启动脚本到服务器中 | ||
run: sshpass -p ${{secrets.REMOTE_PWD_V}} scp -r -o StrictHostKeyChecking=no ./target/iot-gateway.jar ./run.sh root@${{secrets.REMOTE_IP_V}}:/my/iot-gateway | ||
|
||
- name: 启动项目 | ||
run: sshpass -p ${{secrets.REMOTE_PWD_V}} ssh -o StrictHostKeyChecking=no root@${{secrets.REMOTE_IP_V}} "cd /my/iot-gateway && chmod +x run.sh && ./run.sh" |