Remove release workflow, add forgejo deployment workflow

This commit is contained in:
Zack Welch
2026-07-04 11:50:28 -04:00
parent 1c2397acdd
commit 9acb432768
4 changed files with 47 additions and 132 deletions
+40
View File
@@ -0,0 +1,40 @@
# Deploy mcp to the MCP host and restart its user service
# Runs on a SEPARATE Forgejo Actions runner that SSHes into the host and calls the shared sync script (mcp-configs/sync-server.sh, installed as ~/bin/mcp-sync).
# The SSH user owns the clones ($MCP_BASE) and runs the servers as systemd --user
# units; enable lingering once with: loginctl enable-linger <user>.
# Required ORG-level secrets (mcp org > Settings > Actions > Secrets):
# DEPLOY_SSH_HOST e.g. 192.168.0.17
# DEPLOY_SSH_USER login user that owns the clones + user units (no sudo needed)
# DEPLOY_SSH_KEY private key (PEM) whose pubkey is in that user's authorized_keys
# DEPLOY_SSH_PORT optional, defaults to 22
name: deploy
on:
push:
branches: [main]
workflow_dispatch:
concurrency:
group: deploy-truenas-mcp
cancel-in-progress: false
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Deploy over SSH
env:
SSH_HOST: ${{ secrets.DEPLOY_SSH_HOST }}
SSH_USER: ${{ secrets.DEPLOY_SSH_USER }}
SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
SSH_PORT: ${{ secrets.DEPLOY_SSH_PORT }}
run: |
set -euo pipefail
mkdir -p ~/.ssh && chmod 700 ~/.ssh
printf '%s\n' "$SSH_KEY" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
PORT="${SSH_PORT:-22}"
ssh-keyscan -p "$PORT" -H "$SSH_HOST" >> ~/.ssh/known_hosts 2>/dev/null
ssh -i ~/.ssh/deploy_key -p "$PORT" -o StrictHostKeyChecking=yes \
"$SSH_USER@$SSH_HOST" 'bash -seuo pipefail' <<'REMOTE'
exec ~/bin/mcp-sync truenas-mcp
REMOTE
+7 -27
View File
@@ -9,19 +9,19 @@ on:
jobs:
build:
name: Build Binaries
runs-on: ubuntu-latest
runs-on: self-hosted
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version: '1.22'
go-version: '1.24'
- name: Cache Go modules
uses: actions/cache@v4
uses: actions/cache@v6
with:
path: |
~/.cache/go-build
@@ -51,7 +51,7 @@ jobs:
echo '```' >> $GITHUB_STEP_SUMMARY
- name: Upload coverage to artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v9
with:
name: coverage-report
path: |
@@ -59,31 +59,11 @@ jobs:
coverage.txt
retention-days: 30
- name: Build for macOS ARM64
run: GOOS=darwin GOARCH=arm64 go build -o truenas-mcp-darwin-arm64 ./cmd/truenas-mcp
- name: Build for Windows AMD64
run: GOOS=windows GOARCH=amd64 go build -o truenas-mcp-windows-amd64.exe ./cmd/truenas-mcp
- name: Build for Linux AMD64
run: GOOS=linux GOARCH=amd64 go build -o truenas-mcp-linux-amd64 ./cmd/truenas-mcp
- name: Upload macOS ARM64 binary
uses: actions/upload-artifact@v4
with:
name: truenas-mcp-darwin-arm64
path: truenas-mcp-darwin-arm64
retention-days: 30
- name: Upload Windows AMD64 binary
uses: actions/upload-artifact@v4
with:
name: truenas-mcp-windows-amd64
path: truenas-mcp-windows-amd64.exe
retention-days: 30
- name: Upload Linux AMD64 binary
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v9
with:
name: truenas-mcp-linux-amd64
path: truenas-mcp-linux-amd64
-75
View File
@@ -1,75 +0,0 @@
name: Release
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: write
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Download dependencies
run: go mod download
- name: Run linters
run: make lint
- name: Run tests
run: make test
- name: Build for macOS ARM64
run: GOOS=darwin GOARCH=arm64 go build -o truenas-mcp-darwin-arm64 ./cmd/truenas-mcp
- name: Build for Windows AMD64
run: GOOS=windows GOARCH=amd64 go build -o truenas-mcp-windows-amd64.exe ./cmd/truenas-mcp
- name: Build for Linux AMD64
run: GOOS=linux GOARCH=amd64 go build -o truenas-mcp-linux-amd64 ./cmd/truenas-mcp
- name: Package binaries
run: |
tar -czf truenas-mcp-darwin-arm64.tar.gz truenas-mcp-darwin-arm64
tar -czf truenas-mcp-linux-amd64.tar.gz truenas-mcp-linux-amd64
zip truenas-mcp-windows-amd64.zip truenas-mcp-windows-amd64.exe
- name: Generate checksums
run: |
sha256sum truenas-mcp-darwin-arm64.tar.gz > checksums.txt
sha256sum truenas-mcp-linux-amd64.tar.gz >> checksums.txt
sha256sum truenas-mcp-windows-amd64.zip >> checksums.txt
- name: Extract release notes
id: release_notes
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
echo "Release $TAG_NAME" > release_notes.md
- name: Create Release
uses: softprops/action-gh-release@v1
with:
name: Release ${{ steps.release_notes.outputs.tag_name }}
body_path: release_notes.md
draft: false
prerelease: false
files: |
truenas-mcp-darwin-arm64.tar.gz
truenas-mcp-linux-amd64.tar.gz
truenas-mcp-windows-amd64.zip
checksums.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-30
View File
@@ -1,30 +0,0 @@
[Unit]
Description=TrueNAS MCP Server
Documentation=https://github.com/truenas/truenas-mcp
After=network.target middlewared.service
Wants=middlewared.service
[Service]
Type=simple
ExecStart=/usr/local/bin/truenas-mcp -listen 0.0.0.0:8080
Restart=on-failure
RestartSec=5s
# Environment
Environment="TRUENAS_SOCKET=/var/run/middleware/middleware.sock"
Environment="TRUENAS_MCP_API_KEY=change-me-to-secure-key"
# Security settings
# Note: May need to adjust User/Group if middleware socket requires specific permissions
# User=nobody
# Group=nogroup
NoNewPrivileges=true
PrivateTmp=true
# Logging
StandardOutput=journal
StandardError=journal
SyslogIdentifier=truenas-mcp
[Install]
WantedBy=multi-user.target