赞
踩
Gitea Actions有两种使用方法,其中一种是在本地部署一个Gitea实例使用,另一种是直接通过Gitea官方使用。下边将分别介绍两种方法。
目前可以从 @wolfogre 的开发分支克隆带有 Actions 模块的源代码到本地编译。
git clone https://github.com/wolfogre/gitea.git --branch=feature/bots
cd gitea
TAGS="bindata sqlite sqlite_unlock_notify" make build
./gitea web
./costum/conf/app.ini
,编辑该文件,加入以下内容,开启actions功能。[actions]
ENABLED = true
git clone https://gitea.com/gitea/act_runner.git
cd act_runner
make build
./act_runner register
INFO Registering runner, arch=amd64, os=linux, version=0.1.5.
WARN Runner in user-mode.
INFO Enter the Gitea instance URL (for example, https://gitea.com/): [输入服务器地址]
INFO Enter the runner token: [输入 Runner 令牌]
INFO Enter the runner name (if set empty, use hostname:ubuntu ): [输入 Runner 名称]
INFO Enter the runner labels, leave blank to use the default labels (comma-separated, for example, ubuntu-20.04:docker://node:16-bullseye,ubuntu-18.04:docker://node:16-buster): [输入 Runner 标签]
sudo ./act_runner daemon
.gitea/workflows/
路径中,执行CI任务,yaml文件可以是以下示例内容,上传后可以看到Actions中多了一个正在执行的任务,同时本地的Runner开始工作name: Gitea Actions Demo run-name: ${{ github.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 ${{ github.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 ${{ github.ref }} and your repository is ${{ github.repository }}." - run: echo " The ${{ github.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 ${{ github.workspace }} - run: echo " This job's status is ${{ job.status }}."
通过官方使用时可以直接略过上述过程的配置Gitea实例的步骤,从创建仓库开始,并且需要在注册Runner时将实例网址改为https://gitea.com/
。官方当前版本较上述版本较新,部分页面布局有所出入,但大体操作步骤相似。
目前暂时还不清楚当有action任务的时候是如何选择Runner的,本人尝试在一个同时拥有空闲实例级别和存储库级别Runner的存储库中提交action任务,使用的是实例级别的Runner,暂时未发现有主动设置Runner优先级的功能。
附Gitea官方文档连接:官方文档
参考文章:https://zhuanlan.zhihu.com/p/592367216
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。