Agent skill

github-actions-ssh-deploy

交互式配置 GitHub Actions 通过 SSH 密钥连接 VPS 的向导。当用户需要设置 GitHub Actions 部署到 VPS、配置 CI/CD SSH 连接、生成部署 workflow 时使用此 skill。通过问答方式收集必要信息后生成完整配置。

Stars 1
Forks 0

Install this agent skill to your Project

npx add-skill https://github.com/refly-ai/skill-to-workflow/tree/main/skills-source/zijiebijiben/github-actions-skill

SKILL.md

GitHub Actions SSH Deploy 配置向导

通过问答式交互,帮助用户完成 GitHub Actions 连接 VPS 的 SSH 配置。

工作流程

阶段一:信息收集

按顺序逐个询问以下信息,每次只问一个问题,等待用户回答后再继续:

必填信息:

  1. VPS 主机地址 - "请提供 VPS 的 IP 地址或域名:"
  2. SSH 用户名 - "请提供 SSH 登录用户名:"
  3. 项目部署路径 - "请提供项目在 VPS 上的部署路径(如 /var/www/myapp):"
  4. 部署方式 - "请选择部署方式:(1) 执行命令部署 (2) rsync 同步文件 (3) 两者都要"

可选信息(询问是否需要自定义):

  1. SSH 端口 - "SSH 端口是否为默认的 22?如需自定义请输入端口号,否则回复'是'或直接回车:"
  2. 触发分支 - "部署触发分支是否为 main?如需其他分支请输入,否则回复'是'或直接回车:"
  3. 部署命令(如选择命令部署)- "请提供部署时需要执行的命令(可多行):"
  4. 同步源目录(如选择 rsync)- "请提供需要同步的本地目录(如 ./dist):"

阶段二:信息确认

收集完毕后,以表格形式展示所有配置信息,请用户确认:

配置确认:
┌─────────────┬──────────────────────────┐
│ 配置项       │ 值                       │
├─────────────┼──────────────────────────┤
│ VPS 主机     │ {host}                   │
│ SSH 用户名   │ {user}                   │
│ SSH 端口     │ {port}                   │
│ 部署路径     │ {deploy_path}            │
│ 触发分支     │ {branch}                 │
│ 部署方式     │ {deploy_method}          │
└─────────────┴──────────────────────────┘

请确认以上信息是否正确?(是/否)

阶段三:生成配置

确认后,按以下顺序输出:

1. SSH 密钥生成命令

bash
ssh-keygen -t ed25519 -C "github-actions-deploy" -f ~/.ssh/github_actions -N ""

2. VPS 配置命令

bash
# 将公钥添加到 VPS(替换 {user} 和 {host})
ssh-copy-id -i ~/.ssh/github_actions.pub {user}@{host}

# 或手动添加
cat ~/.ssh/github_actions.pub | ssh {user}@{host} "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"

3. GitHub Secrets 配置清单

输出需要在 GitHub 仓库设置的 Secrets:

Secret 名称 值来源
SSH_PRIVATE_KEY cat ~/.ssh/github_actions 的输出内容
SSH_HOST {host}
SSH_USER {user}
SSH_PORT {port}(仅当非默认 22 时需要)

4. GitHub Actions Workflow 文件

根据用户选择的部署方式生成 .github/workflows/deploy.yml

命令执行方式模板:

yaml
name: Deploy to VPS

on:
  push:
    branches: [{branch}]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Deploy via SSH
        uses: appleboy/ssh-action@v1.0.3
        with:
          host: ${{ secrets.SSH_HOST }}
          username: ${{ secrets.SSH_USER }}
          key: ${{ secrets.SSH_PRIVATE_KEY }}
          port: ${{ secrets.SSH_PORT }}
          script: |
            cd {deploy_path}
            {deploy_commands}

rsync 同步方式模板:

yaml
name: Deploy to VPS

on:
  push:
    branches: [{branch}]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Setup SSH
        run: |
          mkdir -p ~/.ssh
          echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
          chmod 600 ~/.ssh/id_ed25519
          ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts

      - name: Deploy with rsync
        run: |
          rsync -avz --delete {source_dir}/ ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:{deploy_path}/

阶段四:操作指引

生成配置后,提供分步操作指引:

接下来请按以下步骤操作:

1. 在本地终端运行密钥生成命令
2. 运行 VPS 配置命令,将公钥添加到服务器
3. 前往 GitHub 仓库 -> Settings -> Secrets and variables -> Actions
4. 点击 "New repository secret" 添加上述 Secrets
5. 将 workflow 文件保存到项目的 .github/workflows/deploy.yml
6. 提交并推送代码,触发自动部署

测试连接(可选):
ssh -i ~/.ssh/github_actions {user}@{host}

注意事项

  • 每次只问一个问题,保持对话简洁
  • 对于可选项,提供合理的默认值
  • 如果用户提供的信息有明显问题(如路径格式错误),及时指出并请求更正
  • 生成的 workflow 文件应直接可用,无需用户额外修改
  • 最终输出时创建实际的 .yml 文件供用户下载

Expand your agent's capabilities with these related and highly-rated skills.

refly-ai/skill-to-workflow

distinctive-frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

1 0
Explore
refly-ai/skill-to-workflow

agent-md-generator

交互式生成 GitHub Copilot agents.md 文件的工作流。当用户请求创建代理、构建自定义 Copilot 代理、生成 agents.md 或需要帮助配置 GitHub Copilot 自定义代理时使用。触发短语包括"创建代理"、"生成 agent.md"、"做一个文档代理"、"生成测试代理"等涉及 GitHub Copilot 代理配置的请求。

1 0
Explore
refly-ai/skill-to-workflow

httpie-api-test

API 接口测试工作流,使用 HTTPie 作为核心工具。当用户需要测试 API 接口、执行接口调用、生成测试报告、管理接口依赖关系、或在项目中建立标准化的接口测试流程时使用此 skill。适用于 RESTful API 测试、接口联调、回归测试等场景。

1 0
Explore
refly-ai/skill-to-workflow

sdd-development

Specification-Driven Development (SDD) methodology for building software where specifications are executable and drive code generation. Use when users want to: (1) Create feature specifications with /speckit.specify, (2) Generate implementation plans with /speckit.plan, (3) Create executable tasks with /speckit.tasks, (4) Follow test-first, library-first development, or (5) Implement constitutional architecture principles. Essential for structured AI-assisted development workflows.

1 0
Explore
refly-ai/skill-to-workflow

notebooklm

Use this skill to query your Google NotebookLM notebooks directly from Claude Code for source-grounded, citation-backed answers from Gemini. Browser automation, library management, persistent auth. Drastically reduced hallucinations through document-only responses.

1 0
Explore
refly-ai/skill-to-workflow

long-running-agent

Framework for building AI agents that work effectively across multiple context windows on complex, long-running tasks. Use when building agents for multi-hour/multi-day projects, implementing persistent coding workflows, creating systems that need state management across sessions, or when an agent needs to make incremental progress on large codebases. Provides initializer and coding agent patterns, progress tracking, feature management, and session handoff strategies.

1 0
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results