.gitea/workflows/demo.yaml
This commit is contained in:
parent
3acee2404a
commit
7326ed926f
@ -1,72 +1,3 @@
|
|||||||
ctrl
|
|
||||||
K
|
|
||||||
Gitea Logo
|
|
||||||
|
|
||||||
UsageactionsQuick Start
|
|
||||||
|
|
||||||
Version: 1.21.2
|
|
||||||
Quick Start
|
|
||||||
|
|
||||||
This page will guide you through the process of using Gitea Actions.
|
|
||||||
Set up Gitea
|
|
||||||
|
|
||||||
First of all, you need a Gitea instance. You can follow the documentation to set up a new instance or upgrade your existing one. It doesn't matter how you install or run Gitea, as long as its version is 1.19.0 or higher.
|
|
||||||
|
|
||||||
Since 1.21.0, Actions are enabled by default. If you are using versions before 1.21.0, you need to add the following to the configuration file to enable it:
|
|
||||||
|
|
||||||
[actions]
|
|
||||||
ENABLED=true
|
|
||||||
|
|
||||||
If you want to learn more or encounter any problems while configuring it, please refer to the Configuration Cheat Sheet.
|
|
||||||
Set up runner
|
|
||||||
|
|
||||||
Gitea Actions requires act runner to run the jobs. In order to avoid consuming too many resources and affecting the Gitea instance, it is recommended to start runners on separate machines from the Gitea instance.
|
|
||||||
|
|
||||||
You can use the pre-built binaries or the docker images to set up the runner.
|
|
||||||
|
|
||||||
Before proceeding any further, we suggest running it as a command line with pre-built binaries to ensure that it works with your environment, especially if you are running a runner on your local host. And it could be easier to debug if something goes wrong.
|
|
||||||
|
|
||||||
The runner can run the jobs in isolated Docker containers, so you need to make sure that the Docker has been installed and Docker daemon is running. While it is not strictly necessary, because the runner can also run the jobs directly on the host, it depends on how you configure it. However, it is recommended to use Docker to run the jobs, because it is more secure and easier to manage.
|
|
||||||
|
|
||||||
Before running a runner, you should first register it to your Gitea instance using the following command:
|
|
||||||
|
|
||||||
./act_runner register --no-interactive --instance <instance> --token <token>
|
|
||||||
|
|
||||||
There are two arguments required, instance and token.
|
|
||||||
|
|
||||||
instance refers to the address of your Gitea instance, like http://192.168.8.8:3000 or https://gitea.com. The runner and job containers (which are started by the runner to execute jobs) will connect to this address. This means that it could be different from the ROOT_URL of your Gitea instance, which is configured for web access. It is always a bad idea to use a loopback address such as 127.0.0.1 or localhost. If you are unsure which address to use, the LAN address is usually the right choice.
|
|
||||||
|
|
||||||
token is used for authentication and identification, such as P2U1U0oB4XaRCi8azcngmPCLbRpUGapalhmddh23. It is one-time use only and cannot be used to register multiple runners. You can obtain different levels of 'tokens' from the following places to create the corresponding level of' runners':
|
|
||||||
|
|
||||||
Instance level: The admin settings page, like <your_gitea.com>/admin/actions/runners.
|
|
||||||
Organization level: The organization settings page, like <your_gitea.com>/<org>/settings/actions/runners.
|
|
||||||
Repository level: The repository settings page, like <your_gitea.com>/<owner>/<repo>/settings/actions/runners.
|
|
||||||
|
|
||||||
register runner
|
|
||||||
|
|
||||||
After registering, a new file named .runner will appear in the current directory. This file stores the registration information. Please do not edit it manually. If this file is missing or corrupted, you can simply remove it and register again.
|
|
||||||
|
|
||||||
Finally, it's time to start the runner:
|
|
||||||
|
|
||||||
./act_runner daemon
|
|
||||||
|
|
||||||
And you can see the new runner in the management page:
|
|
||||||
|
|
||||||
view runner
|
|
||||||
|
|
||||||
You can find more information by visiting Act runner.
|
|
||||||
Use Actions
|
|
||||||
|
|
||||||
Even if Actions is enabled for the Gitea instance, repositories still disable Actions by default.
|
|
||||||
|
|
||||||
To enable it, go to the settings page of your repository like your_gitea.com/<owner>/repo/settings and enable Enable Repository Actions.
|
|
||||||
|
|
||||||
enable actions
|
|
||||||
|
|
||||||
The next steps may be rather complicated. You will need to study the workflow syntax for Actions and write the workflow files you want.
|
|
||||||
|
|
||||||
However, we can just start from a simple demo:
|
|
||||||
|
|
||||||
name: Gitea Actions Demo
|
name: Gitea Actions Demo
|
||||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
||||||
on: [push]
|
on: [push]
|
||||||
@ -86,4 +17,3 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
ls ${{ gitea.workspace }}
|
ls ${{ gitea.workspace }}
|
||||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
- run: echo "🍏 This job's status is ${{ job.status }}."
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user