mirror of
https://github.com/komari-monitor/komari.git
synced 2025-11-02 04:53:27 +00:00
cd: 使用完整前端
This commit is contained in:
33
.github/workflows/development.yml
vendored
33
.github/workflows/development.yml
vendored
@@ -6,7 +6,6 @@ on:
|
||||
- dev
|
||||
workflow_dispatch:
|
||||
|
||||
|
||||
jobs:
|
||||
build-binaries:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -15,52 +14,62 @@ jobs:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Create dummy index.html
|
||||
#- name: Create dummy index.html
|
||||
# run: |
|
||||
# mkdir -p public/dist
|
||||
# echo "<html><body><h1>This is komari development server.</h1></body></html>" > public/dist/index.html
|
||||
|
||||
- name: Clone and build frontend
|
||||
run: |
|
||||
git clone https://github.com/komari-monitor/komari-web web
|
||||
cd web
|
||||
npm install
|
||||
npm run build
|
||||
cd ..
|
||||
mkdir -p public/dist
|
||||
echo "<html><body><h1>This is komari development server.</h1></body></html>" > public/dist/index.html
|
||||
cp -r web/dist/* public/dist/
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.23'
|
||||
|
||||
go-version: "1.23"
|
||||
|
||||
- name: Build application
|
||||
env:
|
||||
GOOS: linux
|
||||
GOARCH: amd64
|
||||
run: |
|
||||
go build -o komari .
|
||||
|
||||
|
||||
- name: Upload binary as artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: komari
|
||||
path: komari
|
||||
|
||||
|
||||
deploy-to-production:
|
||||
needs: build-binaries
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
PRODUCTION_SERVER: ${{ vars.PRODUCTION_SERVER }}
|
||||
if: github.ref == 'refs/heads/dev'
|
||||
|
||||
|
||||
steps:
|
||||
- name: Download binary
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: komari
|
||||
|
||||
|
||||
- name: Setup SSH Key
|
||||
uses: webfactory/ssh-agent@v0.8.0
|
||||
with:
|
||||
ssh-private-key: ${{ secrets.PRODUCTION_SSH_KEY }}
|
||||
|
||||
|
||||
- name: Add host to known hosts
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
ssh-keyscan -H ${{ env.PRODUCTION_SERVER }} >> ~/.ssh/known_hosts
|
||||
|
||||
|
||||
- name: Deploy to production
|
||||
run: |
|
||||
chmod +x komari
|
||||
@@ -69,4 +78,4 @@ jobs:
|
||||
ssh root@${{ env.PRODUCTION_SERVER }} 'rm -f /opt/komari/komari.old'
|
||||
ssh root@${{ env.PRODUCTION_SERVER }} 'mv /opt/komari/komari /opt/komari/komari.old || true'
|
||||
scp komari root@${{ env.PRODUCTION_SERVER }}:/opt/komari/komari
|
||||
ssh root@${{ env.PRODUCTION_SERVER }} 'systemctl start komari.service'
|
||||
ssh root@${{ env.PRODUCTION_SERVER }} 'systemctl start komari.service'
|
||||
|
||||
Reference in New Issue
Block a user