<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>自动化 on Harry&#39;s Blog</title>
    <link>https://sudo-djug.xyz/tags/%E8%87%AA%E5%8A%A8%E5%8C%96/</link>
    <description>Recent content in 自动化 on Harry&#39;s Blog</description>
    <generator>Hugo</generator>
    <language>zh-cn</language>
    <lastBuildDate>Sun, 14 Jan 2024 00:00:00 +0800</lastBuildDate>
    <atom:link href="https://sudo-djug.xyz/tags/%E8%87%AA%E5%8A%A8%E5%8C%96/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>用n8n搭建个人自动化工作流</title>
      <link>https://sudo-djug.xyz/posts/2024-01-14-n8n-automation/</link>
      <pubDate>Sun, 14 Jan 2024 00:00:00 +0800</pubDate>
      <guid>https://sudo-djug.xyz/posts/2024-01-14-n8n-automation/</guid>
      <description>&lt;h1 id=&#34;用n8n搭建个人自动化工作流&#34;&gt;用n8n搭建个人自动化工作流&lt;/h1&gt;
&lt;p&gt;每天要花不少时间处理一些重复性事务，比如备份RSS订阅、整理记账数据、发送定时提醒。最近发现了 &lt;em&gt;n8n&lt;/em&gt;，一个开源的自动化工作流工具，图形化拖拽就能搭建流程。&lt;/p&gt;
&lt;p&gt;部署很简单，&lt;em&gt;Docker&lt;/em&gt; 一行命令搞定：&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;docker run -it --rm \
  --name n8n \
  -p 5678:5678 \
  -v ~/.n8n:/home/node/.n8n \
  n8nio/n8n
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;目前搭了几个实用的小流程：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;每天早上 8 点抓取 &lt;em&gt;GitHub Trending&lt;/em&gt;，把 &lt;em&gt;Python&lt;/em&gt; 和 &lt;em&gt;Go&lt;/em&gt; 的项目推送到 &lt;em&gt;Telegram&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;RSS&lt;/em&gt; 源有新文章时，自动归档到 &lt;em&gt;Notion&lt;/em&gt; 数据库&lt;/li&gt;
&lt;li&gt;每月 1 号生成上月的服务器流量报告，邮件发送给自己&lt;/li&gt;
&lt;/ul&gt;
&lt;h6 id=&#34;相比其他工具的优势&#34;&gt;相比其他工具的优势&lt;/h6&gt;
&lt;ul&gt;
&lt;li&gt;开源免费，数据存在本地&lt;/li&gt;
&lt;li&gt;节点丰富，支持 &lt;em&gt;HTTP Request&lt;/em&gt;、数据库、各种 &lt;em&gt;SaaS&lt;/em&gt; 服务&lt;/li&gt;
&lt;li&gt;错误处理和重试机制做得不错&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;p&gt;自动化虽然前期搭建花时间，但跑起来之后真的可以省下很多精力。打算再研究一下 &lt;em&gt;n8n&lt;/em&gt; 的 &lt;em&gt;Webhook&lt;/em&gt; 功能，把更多外部服务接进来。&lt;/p&gt;</description>
    </item>
    <item>
      <title>GitHub Actions自动化部署初体验</title>
      <link>https://sudo-djug.xyz/posts/2023-02-18-github-actions-deploy/</link>
      <pubDate>Sat, 18 Feb 2023 00:00:00 +0800</pubDate>
      <guid>https://sudo-djug.xyz/posts/2023-02-18-github-actions-deploy/</guid>
      <description>&lt;h1 id=&#34;github-actions自动化部署初体验&#34;&gt;GitHub Actions自动化部署初体验&lt;/h1&gt;
&lt;p&gt;之前每次改完博客都要手动 &lt;em&gt;build&lt;/em&gt; 再 &lt;em&gt;rsync&lt;/em&gt; 到服务器，步骤虽然不多，但重复多了也烦。今天学习了一下 &lt;em&gt;GitHub Actions&lt;/em&gt;，把部署流程自动化了。&lt;/p&gt;
&lt;p&gt;核心思路很简单：代码 &lt;em&gt;push&lt;/em&gt; 到 &lt;em&gt;main&lt;/em&gt; 分支 → 触发 &lt;em&gt;workflow&lt;/em&gt; → 执行 &lt;em&gt;hugo&lt;/em&gt; 构建 → &lt;em&gt;rsync&lt;/em&gt; 到 &lt;em&gt;VPS&lt;/em&gt;。&lt;/p&gt;
&lt;p&gt;&lt;code&gt;.github/workflows/deploy.yml&lt;/code&gt; 的关键配置：&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;on:
  push:
    branches: [main]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: peaceiris/actions-hugo@v2
      - run: hugo --minify
      - run: rsync -avz ./public/ user@host:/var/www/...
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;踩了一个坑：&lt;em&gt;rsync&lt;/em&gt; 需要 &lt;em&gt;SSH&lt;/em&gt; 密钥，要把私钥存到仓库的 &lt;em&gt;Secrets&lt;/em&gt; 里，然后在 workflow 里引用。一开始密钥格式没弄对，报错 &lt;em&gt;Load key invalid format&lt;/em&gt;，后来删掉多余的换行才解决。&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;现在每次写完文章，&lt;em&gt;git push&lt;/em&gt; 之后等一分钟，网站就自动更新了。自动化果然是第一生产力。&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
