fix:调试github actions #40
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 workflow will build a package using Maven and then publish it to GitHub packages when a release is created | |
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path | |
name: chathub的部署与运行 | |
#推送事件触发 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
chat-hub-build: | |
name: chathub构建 | |
# 权限 | |
permissions: | |
contents: read | |
packages: write | |
# 选择系统运行 | |
runs-on: ubuntu-latest | |
#步骤运行命令 | |
steps: | |
- name: 拉取仓库 # -name让github知道这个步骤的名字 | |
# 必须使用这个命令才行 | |
uses: actions/checkout@v4 | |
- name: 下载JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'oracle' # 发布版本 | |
java-version: '17' | |
- name: maven构建Jar包 | |
run: | | |
cd ${{ github.workspace }} | |
mvn -B package -DskipTests --file ./back-end/pom.xml | |
- name: 把推送到目标服务器 | |
uses: garygrossgarten/github-action-scp@release | |
with: | |
local: ${{ github.workspace }}/back-end/application/target/application-1.0.0.jar | |
remote: /home/server/chat-hub/ | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USER }} | |
password: ${{ secrets.SSH_PWD }} | |