mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2026-04-12 11:07:23 +00:00
feat: add master auto deploy workflow
This commit is contained in:
71
.github/workflows/master-auto-deploy.yml
vendored
Normal file
71
.github/workflows/master-auto-deploy.yml
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
name: Master Auto Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: temurin
|
||||
cache: maven
|
||||
|
||||
- name: Build with Maven
|
||||
run: mvn -B package -Dmaven.test.skip=true --file pom.xml
|
||||
|
||||
- name: Upload server jar artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: kkfileview-server-jar
|
||||
path: server/target/kkFileView-*.jar
|
||||
retention-days: 7
|
||||
|
||||
deploy-windows:
|
||||
needs: build
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
GITHUB_REPOSITORY_NAME: ${{ github.repository }}
|
||||
GITHUB_RUN_ID_VALUE: ${{ github.run_id }}
|
||||
GITHUB_TOKEN_VALUE: ${{ github.token }}
|
||||
KK_DEPLOY_HOST: ${{ secrets.KK_DEPLOY_HOST }}
|
||||
KK_DEPLOY_PORT: ${{ secrets.KK_DEPLOY_PORT }}
|
||||
KK_DEPLOY_USERNAME: ${{ secrets.KK_DEPLOY_USERNAME }}
|
||||
KK_DEPLOY_PASSWORD: ${{ secrets.KK_DEPLOY_PASSWORD }}
|
||||
KK_DEPLOY_ROOT: ${{ secrets.KK_DEPLOY_ROOT }}
|
||||
KK_DEPLOY_HEALTH_URL: ${{ secrets.KK_DEPLOY_HEALTH_URL }}
|
||||
KK_DEPLOY_ARTIFACT_NAME: kkfileview-server-jar
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install WinRM dependencies
|
||||
run: pip install pywinrm
|
||||
|
||||
- name: Validate deploy secrets
|
||||
run: |
|
||||
test -n "$KK_DEPLOY_HOST" || (echo "Missing secret: KK_DEPLOY_HOST" && exit 1)
|
||||
test -n "$KK_DEPLOY_USERNAME" || (echo "Missing secret: KK_DEPLOY_USERNAME" && exit 1)
|
||||
test -n "$KK_DEPLOY_PASSWORD" || (echo "Missing secret: KK_DEPLOY_PASSWORD" && exit 1)
|
||||
|
||||
- name: Deploy to Windows server
|
||||
run: python .github/scripts/deploy_windows_winrm.py
|
||||
Reference in New Issue
Block a user