mirror of
https://github.com/komari-monitor/komari.git
synced 2026-11-24 00:50:49 +00:00
68 lines
1.7 KiB
YAML
68 lines
1.7 KiB
YAML
name: Development Environment
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- dev
|
|
workflow_dispatch:
|
|
|
|
|
|
jobs:
|
|
build-binaries:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- 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: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
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 Linux AMD64 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
|
|
scp komari root@${{ env.PRODUCTION_SERVER }}:/opt/komari/komari
|
|
ssh root@${{ env.PRODUCTION_SERVER }} 'systemctl restart komari.service' |