基于gitea+act_runner 搭建CI/CD自动化部署

基于gitea+act_runner 搭建CI/CD自动化部署

Gitea 的搭建可以参考另一片文章
在Centos 上搭建代码管理平台Gitea

  1. 设置Gitea

    • 要求Gitea版本必须大于1.19.0

    • 小于1.21.0版本需要手动开启actions功能,在app.ini配置文件中

      ini 复制代码
      [actions]
      ENABLED=true
  2. 登录gitea 官网下载与gitea版本对应的act_runner

    https://dl.gitea.com/act_runner/

  3. 注册Runner 实例

    sh 复制代码
    ./act_runner register --no-interactive --instance <instance> --token <token>

    需要两个必需的参数:instancetoken

    instance是您的Gitea实例的地址,如http://192.168.8.8:3000https://gitea.com

    token用于身份验证和标识,例如P2U1U0oB4XaRCi8azcngmPCLbRpUGapalhmddh23. 它只能使用一次,并且不能用于注册多个Runner。 您可以从以下位置获取不同级别的token,从而创建出相应级别的`runner

    • 实例级别:管理员设置页面,例如 <your_gitea.com>/admin/actions/runners
    • 组织级别:组织设置页面,例如 <your_gitea.com>/<org>/settings/actions/runners
    • 存储库级别:存储库设置页面,例如 <your_gitea.com>/<owner>/<repo>/settings/actions/runners

    token 的具体位置在管理后台=>actions=>Runners 创建Runner下生成token

    出现如下内容代表注册成功

  4. 启动Runner

    sh 复制代码
    ./act_runner daemon
  5. 在对应的存储库的设置, 高级设置中启用Actions

    yaml 复制代码
    name: Gitea Actions Demo
    run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
    on: [push]
    
    jobs:
      Explore-Gitea-Actions:
        runs-on: ubuntu-latest
        steps:
          - run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
          - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
          - run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
          - name: Check out repository code
            uses: actions/checkout@v4
          - run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
          - run: echo "🖥️ The workflow is now ready to test your code on the runner."
          - name: List files in the repository
            run: |
              ls ${{ gitea.workspace }}
          - run: echo "🍏 This job's status is ${{ job.status }}."

    上面的就是一个简单的demo, 将此内容存放到存储库的.gitea/workflows/目录中, 文件后缀为.yaml. 例如.gitea/workflows/demo.yaml

相关推荐
无锡耐特森17 分钟前
CANopen转Profinet网关:小设备撬动自动化产线大效率
运维·自动化
北京耐用通信24 分钟前
解码协议迷雾:耐达讯自动化Profinet转Devicenet让食品包装称重模块“跨界对话”的魔法
人工智能·物联网·网络协议·自动化·信息与通信
中科米堆2 小时前
汽车制造厂采用自动化三维扫描系统,将抽检升级为全检-中科米堆CASAIM
运维·自动化·汽车·3d全尺寸检测
我送炭你添花2 小时前
Pelco KBD300A 模拟器:06.用 PyQt5 实现 1:1 像素级完美复刻 Pelco KBD300A 键盘
python·qt·自动化·运维开发
大道随心2 小时前
【QT】自动化设备控制界面搭建
开发语言·qt·自动化
扫描电镜3 小时前
从 G1 到 G7:台式扫描电镜在稳定性与自动化上的技术演进
运维·人工智能·自动化
aloha_7893 小时前
接口自动化框架学习
功能测试·学习·自动化·模块测试
CodeCraft Studio3 小时前
国产化Word处理组件Spire.DOC教程:使用Python将文件自动化批量附加到 Word文档
python·自动化·word·spire.doc·文档自动化·word文档中添加附件·文档批量处理
RPA机器人就选八爪鱼3 小时前
银行业流程自动化升级:RPA 机器人赋能金融数智转型
大数据·人工智能·机器人·自动化·rpa
中科米堆4 小时前
机器人企业采用自动化三维测量方案,完成关节部件快速检测-中科米堆CASAIM
运维·机器人·自动化·3d全尺寸检测