基于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

相关推荐
中国loong1 天前
springcloud网关集成websocket框架
自动化
Qoitech 中国1 天前
Otii 应用场景系列:使用 Otii Arc和Otii Ace进行差分测量
嵌入式硬件·物联网·自动化·集成测试·智能硬件
一只大头猿1 天前
myeclipse-ci-2018安装教程
ide·ci/cd·myeclipse
¿Quién soy yo1 天前
Postman+Newman接口自动化测试:一键生成精美HTML测试报告完整教程
测试工具·自动化·html·postman·持续集成
宇钶宇夕1 天前
魏德米勒 UR20-FBC-PN-IRT-V2 从站全解析:产品特性、模块详情、接线图与地址配置指南(地址修改部分)
运维·自动化
不叫猫先生1 天前
基于AI代理浏览器的自动化数据爬取实践
人工智能·爬虫·自动化
MadPrinter1 天前
FindQC 实战 (一):基于 SerpApi 的电商高质量图片自动化筛选算法初探
运维·python·算法·自动化
胡萝卜的兔1 天前
ci/cd自动化部署
运维·ci/cd·自动化
明达智控技术1 天前
MR30分布式IO:破解汽车焊接产线控制难题
物联网·自动化
明达智控技术1 天前
MR30分布式IO赋能注塑机智能化升级
分布式·物联网·自动化