2023-03-14 12:51:20 +03:00
|
|
|
import {h} from 'vue';
|
2023-05-03 08:23:39 +03:00
|
|
|
import giteaDoubleChevronLeft from '../../public/img/svg/gitea-double-chevron-left.svg';
|
|
|
|
import giteaDoubleChevronRight from '../../public/img/svg/gitea-double-chevron-right.svg';
|
|
|
|
import giteaEmptyCheckbox from '../../public/img/svg/gitea-empty-checkbox.svg';
|
2023-05-14 00:59:01 +03:00
|
|
|
import giteaExclamation from '../../public/img/svg/gitea-exclamation.svg';
|
2023-05-03 08:23:39 +03:00
|
|
|
import octiconArchive from '../../public/img/svg/octicon-archive.svg';
|
|
|
|
import octiconArrowSwitch from '../../public/img/svg/octicon-arrow-switch.svg';
|
|
|
|
import octiconBlocked from '../../public/img/svg/octicon-blocked.svg';
|
|
|
|
import octiconBold from '../../public/img/svg/octicon-bold.svg';
|
2023-05-14 00:59:01 +03:00
|
|
|
import octiconCheck from '../../public/img/svg/octicon-check.svg';
|
2023-05-03 08:23:39 +03:00
|
|
|
import octiconCheckbox from '../../public/img/svg/octicon-checkbox.svg';
|
|
|
|
import octiconCheckCircleFill from '../../public/img/svg/octicon-check-circle-fill.svg';
|
2020-07-13 16:21:19 +03:00
|
|
|
import octiconChevronDown from '../../public/img/svg/octicon-chevron-down.svg';
|
2023-05-03 08:23:39 +03:00
|
|
|
import octiconChevronLeft from '../../public/img/svg/octicon-chevron-left.svg';
|
2020-07-13 16:21:19 +03:00
|
|
|
import octiconChevronRight from '../../public/img/svg/octicon-chevron-right.svg';
|
2022-06-11 17:44:20 +03:00
|
|
|
import octiconClock from '../../public/img/svg/octicon-clock.svg';
|
2023-05-03 08:23:39 +03:00
|
|
|
import octiconCode from '../../public/img/svg/octicon-code.svg';
|
|
|
|
import octiconColumns from '../../public/img/svg/octicon-columns.svg';
|
2022-12-02 12:42:34 +03:00
|
|
|
import octiconCopy from '../../public/img/svg/octicon-copy.svg';
|
2022-09-27 08:22:19 +03:00
|
|
|
import octiconDiffAdded from '../../public/img/svg/octicon-diff-added.svg';
|
|
|
|
import octiconDiffModified from '../../public/img/svg/octicon-diff-modified.svg';
|
|
|
|
import octiconDiffRemoved from '../../public/img/svg/octicon-diff-removed.svg';
|
|
|
|
import octiconDiffRenamed from '../../public/img/svg/octicon-diff-renamed.svg';
|
2023-05-14 00:59:01 +03:00
|
|
|
import octiconDotFill from '../../public/img/svg/octicon-dot-fill.svg';
|
2023-05-03 08:23:39 +03:00
|
|
|
import octiconEye from '../../public/img/svg/octicon-eye.svg';
|
2022-12-02 12:42:34 +03:00
|
|
|
import octiconFile from '../../public/img/svg/octicon-file.svg';
|
2022-09-27 08:22:19 +03:00
|
|
|
import octiconFileDirectoryFill from '../../public/img/svg/octicon-file-directory-fill.svg';
|
2023-05-03 08:23:39 +03:00
|
|
|
import octiconFilter from '../../public/img/svg/octicon-filter.svg';
|
|
|
|
import octiconGitBranch from '../../public/img/svg/octicon-git-branch.svg';
|
2020-07-12 12:10:56 +03:00
|
|
|
import octiconGitMerge from '../../public/img/svg/octicon-git-merge.svg';
|
|
|
|
import octiconGitPullRequest from '../../public/img/svg/octicon-git-pull-request.svg';
|
2023-05-03 08:23:39 +03:00
|
|
|
import octiconHeading from '../../public/img/svg/octicon-heading.svg';
|
|
|
|
import octiconHorizontalRule from '../../public/img/svg/octicon-horizontal-rule.svg';
|
|
|
|
import octiconImage from '../../public/img/svg/octicon-image.svg';
|
2020-07-12 12:10:56 +03:00
|
|
|
import octiconIssueClosed from '../../public/img/svg/octicon-issue-closed.svg';
|
|
|
|
import octiconIssueOpened from '../../public/img/svg/octicon-issue-opened.svg';
|
2023-05-03 08:23:39 +03:00
|
|
|
import octiconItalic from '../../public/img/svg/octicon-italic.svg';
|
2021-05-19 06:16:02 +03:00
|
|
|
import octiconKebabHorizontal from '../../public/img/svg/octicon-kebab-horizontal.svg';
|
2020-07-12 12:10:56 +03:00
|
|
|
import octiconLink from '../../public/img/svg/octicon-link.svg';
|
2023-05-03 08:23:39 +03:00
|
|
|
import octiconListOrdered from '../../public/img/svg/octicon-list-ordered.svg';
|
|
|
|
import octiconListUnordered from '../../public/img/svg/octicon-list-unordered.svg';
|
2020-07-13 02:48:48 +03:00
|
|
|
import octiconLock from '../../public/img/svg/octicon-lock.svg';
|
2023-05-03 08:23:39 +03:00
|
|
|
import octiconMeter from '../../public/img/svg/octicon-meter.svg';
|
2020-11-29 09:22:04 +03:00
|
|
|
import octiconMilestone from '../../public/img/svg/octicon-milestone.svg';
|
2020-07-17 18:15:12 +03:00
|
|
|
import octiconMirror from '../../public/img/svg/octicon-mirror.svg';
|
2023-05-03 08:23:39 +03:00
|
|
|
import octiconOrganization from '../../public/img/svg/octicon-organization.svg';
|
2023-05-01 17:14:20 +03:00
|
|
|
import octiconPlay from '../../public/img/svg/octicon-play.svg';
|
2023-05-03 08:23:39 +03:00
|
|
|
import octiconPlus from '../../public/img/svg/octicon-plus.svg';
|
2020-11-29 09:22:04 +03:00
|
|
|
import octiconProject from '../../public/img/svg/octicon-project.svg';
|
2023-05-03 08:23:39 +03:00
|
|
|
import octiconQuote from '../../public/img/svg/octicon-quote.svg';
|
2020-07-13 02:48:48 +03:00
|
|
|
import octiconRepo from '../../public/img/svg/octicon-repo.svg';
|
|
|
|
import octiconRepoForked from '../../public/img/svg/octicon-repo-forked.svg';
|
|
|
|
import octiconRepoTemplate from '../../public/img/svg/octicon-repo-template.svg';
|
2023-05-03 08:23:39 +03:00
|
|
|
import octiconRss from '../../public/img/svg/octicon-rss.svg';
|
|
|
|
import octiconScreenFull from '../../public/img/svg/octicon-screen-full.svg';
|
|
|
|
import octiconSearch from '../../public/img/svg/octicon-search.svg';
|
2022-09-27 08:22:19 +03:00
|
|
|
import octiconSidebarCollapse from '../../public/img/svg/octicon-sidebar-collapse.svg';
|
2022-12-02 12:42:34 +03:00
|
|
|
import octiconSidebarExpand from '../../public/img/svg/octicon-sidebar-expand.svg';
|
Implement actions (#21937)
Close #13539.
Co-authored by: @lunny @appleboy @fuxiaohei and others.
Related projects:
- https://gitea.com/gitea/actions-proto-def
- https://gitea.com/gitea/actions-proto-go
- https://gitea.com/gitea/act
- https://gitea.com/gitea/act_runner
### Summary
The target of this PR is to bring a basic implementation of "Actions",
an internal CI/CD system of Gitea. That means even though it has been
merged, the state of the feature is **EXPERIMENTAL**, and please note
that:
- It is disabled by default;
- It shouldn't be used in a production environment currently;
- It shouldn't be used in a public Gitea instance currently;
- Breaking changes may be made before it's stable.
**Please comment on #13539 if you have any different product design
ideas**, all decisions reached there will be adopted here. But in this
PR, we don't talk about **naming, feature-creep or alternatives**.
### ⚠️ Breaking
`gitea-actions` will become a reserved user name. If a user with the
name already exists in the database, it is recommended to rename it.
### Some important reviews
- What is `DEFAULT_ACTIONS_URL` in `app.ini` for?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1055954954
- Why the api for runners is not under the normal `/api/v1` prefix?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1061173592
- Why DBFS?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1061301178
- Why ignore events triggered by `gitea-actions` bot?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1063254103
- Why there's no permission control for actions?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1090229868
### What it looks like
<details>
#### Manage runners
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205870657-c72f590e-2e08-4cd4-be7f-2e0abb299bbf.png">
#### List runs
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205872794-50fde990-2b45-48c1-a178-908e4ec5b627.png">
#### View logs
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205872501-9b7b9000-9542-4991-8f55-18ccdada77c3.png">
</details>
### How to try it
<details>
#### 1. Start Gitea
Clone this branch and [install from
source](https://docs.gitea.io/en-us/install-from-source).
Add additional configurations in `app.ini` to enable Actions:
```ini
[actions]
ENABLED = true
```
Start it.
If all is well, you'll see the management page of runners:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205877365-8e30a780-9b10-4154-b3e8-ee6c3cb35a59.png">
#### 2. Start runner
Clone the [act_runner](https://gitea.com/gitea/act_runner), and follow
the
[README](https://gitea.com/gitea/act_runner/src/branch/main/README.md)
to start it.
If all is well, you'll see a new runner has been added:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205878000-216f5937-e696-470d-b66c-8473987d91c3.png">
#### 3. Enable actions for a repo
Create a new repo or open an existing one, check the `Actions` checkbox
in settings and submit.
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205879705-53e09208-73c0-4b3e-a123-2dcf9aba4b9c.png">
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205879383-23f3d08f-1a85-41dd-a8b3-54e2ee6453e8.png">
If all is well, you'll see a new tab "Actions":
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205881648-a8072d8c-5803-4d76-b8a8-9b2fb49516c1.png">
#### 4. Upload workflow files
Upload some workflow files to `.gitea/workflows/xxx.yaml`, you can
follow the [quickstart](https://docs.github.com/en/actions/quickstart)
of GitHub Actions. Yes, Gitea Actions is compatible with GitHub Actions
in most cases, you can use the same demo:
```yaml
name: GitHub Actions Demo
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on: [push]
jobs:
Explore-GitHub-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 GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v3
- 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 }}."
```
If all is well, you'll see a new run in `Actions` tab:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205884473-79a874bc-171b-4aaf-acd5-0241a45c3b53.png">
#### 5. Check the logs of jobs
Click a run and you'll see the logs:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205884800-994b0374-67f7-48ff-be9a-4c53f3141547.png">
#### 6. Go on
You can try more examples in [the
documents](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions)
of GitHub Actions, then you might find a lot of bugs.
Come on, PRs are welcome.
</details>
See also: [Feature Preview: Gitea
Actions](https://blog.gitea.io/2022/12/feature-preview-gitea-actions/)
---------
Co-authored-by: a1012112796 <1012112796@qq.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: ChristopherHX <christopher.homberger@web.de>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2023-01-31 04:45:19 +03:00
|
|
|
import octiconSkip from '../../public/img/svg/octicon-skip.svg';
|
2023-03-14 07:09:06 +03:00
|
|
|
import octiconStar from '../../public/img/svg/octicon-star.svg';
|
2023-05-03 08:23:39 +03:00
|
|
|
import octiconStrikethrough from '../../public/img/svg/octicon-strikethrough.svg';
|
|
|
|
import octiconSync from '../../public/img/svg/octicon-sync.svg';
|
|
|
|
import octiconTable from '../../public/img/svg/octicon-table.svg';
|
2023-03-14 12:51:20 +03:00
|
|
|
import octiconTag from '../../public/img/svg/octicon-tag.svg';
|
2023-05-03 08:23:39 +03:00
|
|
|
import octiconTriangleDown from '../../public/img/svg/octicon-triangle-down.svg';
|
|
|
|
import octiconX from '../../public/img/svg/octicon-x.svg';
|
|
|
|
import octiconXCircleFill from '../../public/img/svg/octicon-x-circle-fill.svg';
|
2022-09-27 08:22:19 +03:00
|
|
|
|
2023-03-14 07:09:06 +03:00
|
|
|
const svgs = {
|
2023-05-03 08:23:39 +03:00
|
|
|
'gitea-double-chevron-left': giteaDoubleChevronLeft,
|
|
|
|
'gitea-double-chevron-right': giteaDoubleChevronRight,
|
|
|
|
'gitea-empty-checkbox': giteaEmptyCheckbox,
|
2023-05-14 00:59:01 +03:00
|
|
|
'gitea-exclamation': giteaExclamation,
|
2023-05-01 01:02:56 +03:00
|
|
|
'octicon-archive': octiconArchive,
|
2023-05-03 08:23:39 +03:00
|
|
|
'octicon-arrow-switch': octiconArrowSwitch,
|
Implement actions (#21937)
Close #13539.
Co-authored by: @lunny @appleboy @fuxiaohei and others.
Related projects:
- https://gitea.com/gitea/actions-proto-def
- https://gitea.com/gitea/actions-proto-go
- https://gitea.com/gitea/act
- https://gitea.com/gitea/act_runner
### Summary
The target of this PR is to bring a basic implementation of "Actions",
an internal CI/CD system of Gitea. That means even though it has been
merged, the state of the feature is **EXPERIMENTAL**, and please note
that:
- It is disabled by default;
- It shouldn't be used in a production environment currently;
- It shouldn't be used in a public Gitea instance currently;
- Breaking changes may be made before it's stable.
**Please comment on #13539 if you have any different product design
ideas**, all decisions reached there will be adopted here. But in this
PR, we don't talk about **naming, feature-creep or alternatives**.
### ⚠️ Breaking
`gitea-actions` will become a reserved user name. If a user with the
name already exists in the database, it is recommended to rename it.
### Some important reviews
- What is `DEFAULT_ACTIONS_URL` in `app.ini` for?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1055954954
- Why the api for runners is not under the normal `/api/v1` prefix?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1061173592
- Why DBFS?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1061301178
- Why ignore events triggered by `gitea-actions` bot?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1063254103
- Why there's no permission control for actions?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1090229868
### What it looks like
<details>
#### Manage runners
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205870657-c72f590e-2e08-4cd4-be7f-2e0abb299bbf.png">
#### List runs
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205872794-50fde990-2b45-48c1-a178-908e4ec5b627.png">
#### View logs
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205872501-9b7b9000-9542-4991-8f55-18ccdada77c3.png">
</details>
### How to try it
<details>
#### 1. Start Gitea
Clone this branch and [install from
source](https://docs.gitea.io/en-us/install-from-source).
Add additional configurations in `app.ini` to enable Actions:
```ini
[actions]
ENABLED = true
```
Start it.
If all is well, you'll see the management page of runners:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205877365-8e30a780-9b10-4154-b3e8-ee6c3cb35a59.png">
#### 2. Start runner
Clone the [act_runner](https://gitea.com/gitea/act_runner), and follow
the
[README](https://gitea.com/gitea/act_runner/src/branch/main/README.md)
to start it.
If all is well, you'll see a new runner has been added:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205878000-216f5937-e696-470d-b66c-8473987d91c3.png">
#### 3. Enable actions for a repo
Create a new repo or open an existing one, check the `Actions` checkbox
in settings and submit.
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205879705-53e09208-73c0-4b3e-a123-2dcf9aba4b9c.png">
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205879383-23f3d08f-1a85-41dd-a8b3-54e2ee6453e8.png">
If all is well, you'll see a new tab "Actions":
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205881648-a8072d8c-5803-4d76-b8a8-9b2fb49516c1.png">
#### 4. Upload workflow files
Upload some workflow files to `.gitea/workflows/xxx.yaml`, you can
follow the [quickstart](https://docs.github.com/en/actions/quickstart)
of GitHub Actions. Yes, Gitea Actions is compatible with GitHub Actions
in most cases, you can use the same demo:
```yaml
name: GitHub Actions Demo
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on: [push]
jobs:
Explore-GitHub-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 GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v3
- 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 }}."
```
If all is well, you'll see a new run in `Actions` tab:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205884473-79a874bc-171b-4aaf-acd5-0241a45c3b53.png">
#### 5. Check the logs of jobs
Click a run and you'll see the logs:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205884800-994b0374-67f7-48ff-be9a-4c53f3141547.png">
#### 6. Go on
You can try more examples in [the
documents](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions)
of GitHub Actions, then you might find a lot of bugs.
Come on, PRs are welcome.
</details>
See also: [Feature Preview: Gitea
Actions](https://blog.gitea.io/2022/12/feature-preview-gitea-actions/)
---------
Co-authored-by: a1012112796 <1012112796@qq.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: ChristopherHX <christopher.homberger@web.de>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2023-01-31 04:45:19 +03:00
|
|
|
'octicon-blocked': octiconBlocked,
|
2023-05-03 08:23:39 +03:00
|
|
|
'octicon-bold': octiconBold,
|
2023-05-14 00:59:01 +03:00
|
|
|
'octicon-check': octiconCheck,
|
Implement actions (#21937)
Close #13539.
Co-authored by: @lunny @appleboy @fuxiaohei and others.
Related projects:
- https://gitea.com/gitea/actions-proto-def
- https://gitea.com/gitea/actions-proto-go
- https://gitea.com/gitea/act
- https://gitea.com/gitea/act_runner
### Summary
The target of this PR is to bring a basic implementation of "Actions",
an internal CI/CD system of Gitea. That means even though it has been
merged, the state of the feature is **EXPERIMENTAL**, and please note
that:
- It is disabled by default;
- It shouldn't be used in a production environment currently;
- It shouldn't be used in a public Gitea instance currently;
- Breaking changes may be made before it's stable.
**Please comment on #13539 if you have any different product design
ideas**, all decisions reached there will be adopted here. But in this
PR, we don't talk about **naming, feature-creep or alternatives**.
### ⚠️ Breaking
`gitea-actions` will become a reserved user name. If a user with the
name already exists in the database, it is recommended to rename it.
### Some important reviews
- What is `DEFAULT_ACTIONS_URL` in `app.ini` for?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1055954954
- Why the api for runners is not under the normal `/api/v1` prefix?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1061173592
- Why DBFS?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1061301178
- Why ignore events triggered by `gitea-actions` bot?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1063254103
- Why there's no permission control for actions?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1090229868
### What it looks like
<details>
#### Manage runners
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205870657-c72f590e-2e08-4cd4-be7f-2e0abb299bbf.png">
#### List runs
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205872794-50fde990-2b45-48c1-a178-908e4ec5b627.png">
#### View logs
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205872501-9b7b9000-9542-4991-8f55-18ccdada77c3.png">
</details>
### How to try it
<details>
#### 1. Start Gitea
Clone this branch and [install from
source](https://docs.gitea.io/en-us/install-from-source).
Add additional configurations in `app.ini` to enable Actions:
```ini
[actions]
ENABLED = true
```
Start it.
If all is well, you'll see the management page of runners:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205877365-8e30a780-9b10-4154-b3e8-ee6c3cb35a59.png">
#### 2. Start runner
Clone the [act_runner](https://gitea.com/gitea/act_runner), and follow
the
[README](https://gitea.com/gitea/act_runner/src/branch/main/README.md)
to start it.
If all is well, you'll see a new runner has been added:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205878000-216f5937-e696-470d-b66c-8473987d91c3.png">
#### 3. Enable actions for a repo
Create a new repo or open an existing one, check the `Actions` checkbox
in settings and submit.
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205879705-53e09208-73c0-4b3e-a123-2dcf9aba4b9c.png">
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205879383-23f3d08f-1a85-41dd-a8b3-54e2ee6453e8.png">
If all is well, you'll see a new tab "Actions":
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205881648-a8072d8c-5803-4d76-b8a8-9b2fb49516c1.png">
#### 4. Upload workflow files
Upload some workflow files to `.gitea/workflows/xxx.yaml`, you can
follow the [quickstart](https://docs.github.com/en/actions/quickstart)
of GitHub Actions. Yes, Gitea Actions is compatible with GitHub Actions
in most cases, you can use the same demo:
```yaml
name: GitHub Actions Demo
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on: [push]
jobs:
Explore-GitHub-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 GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v3
- 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 }}."
```
If all is well, you'll see a new run in `Actions` tab:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205884473-79a874bc-171b-4aaf-acd5-0241a45c3b53.png">
#### 5. Check the logs of jobs
Click a run and you'll see the logs:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205884800-994b0374-67f7-48ff-be9a-4c53f3141547.png">
#### 6. Go on
You can try more examples in [the
documents](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions)
of GitHub Actions, then you might find a lot of bugs.
Come on, PRs are welcome.
</details>
See also: [Feature Preview: Gitea
Actions](https://blog.gitea.io/2022/12/feature-preview-gitea-actions/)
---------
Co-authored-by: a1012112796 <1012112796@qq.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: ChristopherHX <christopher.homberger@web.de>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2023-01-31 04:45:19 +03:00
|
|
|
'octicon-check-circle-fill': octiconCheckCircleFill,
|
2023-05-03 08:23:39 +03:00
|
|
|
'octicon-checkbox': octiconCheckbox,
|
2020-07-13 16:21:19 +03:00
|
|
|
'octicon-chevron-down': octiconChevronDown,
|
2023-05-01 01:02:56 +03:00
|
|
|
'octicon-chevron-left': octiconChevronLeft,
|
2020-07-13 16:21:19 +03:00
|
|
|
'octicon-chevron-right': octiconChevronRight,
|
2022-06-11 17:44:20 +03:00
|
|
|
'octicon-clock': octiconClock,
|
2023-05-03 08:23:39 +03:00
|
|
|
'octicon-code': octiconCode,
|
|
|
|
'octicon-columns': octiconColumns,
|
2022-12-02 12:42:34 +03:00
|
|
|
'octicon-copy': octiconCopy,
|
|
|
|
'octicon-diff-added': octiconDiffAdded,
|
|
|
|
'octicon-diff-modified': octiconDiffModified,
|
|
|
|
'octicon-diff-removed': octiconDiffRemoved,
|
|
|
|
'octicon-diff-renamed': octiconDiffRenamed,
|
2023-05-14 00:59:01 +03:00
|
|
|
'octicon-dot-fill': octiconDotFill,
|
2023-05-03 08:23:39 +03:00
|
|
|
'octicon-eye': octiconEye,
|
2022-12-02 12:42:34 +03:00
|
|
|
'octicon-file': octiconFile,
|
|
|
|
'octicon-file-directory-fill': octiconFileDirectoryFill,
|
2023-05-01 01:02:56 +03:00
|
|
|
'octicon-filter': octiconFilter,
|
|
|
|
'octicon-git-branch': octiconGitBranch,
|
2020-07-12 12:10:56 +03:00
|
|
|
'octicon-git-merge': octiconGitMerge,
|
|
|
|
'octicon-git-pull-request': octiconGitPullRequest,
|
2023-05-03 08:23:39 +03:00
|
|
|
'octicon-heading': octiconHeading,
|
|
|
|
'octicon-horizontal-rule': octiconHorizontalRule,
|
|
|
|
'octicon-image': octiconImage,
|
2020-07-12 12:10:56 +03:00
|
|
|
'octicon-issue-closed': octiconIssueClosed,
|
|
|
|
'octicon-issue-opened': octiconIssueOpened,
|
2023-05-03 08:23:39 +03:00
|
|
|
'octicon-italic': octiconItalic,
|
2021-05-19 06:16:02 +03:00
|
|
|
'octicon-kebab-horizontal': octiconKebabHorizontal,
|
2020-07-12 12:10:56 +03:00
|
|
|
'octicon-link': octiconLink,
|
2023-05-03 08:23:39 +03:00
|
|
|
'octicon-list-ordered': octiconListOrdered,
|
|
|
|
'octicon-list-unordered': octiconListUnordered,
|
2020-07-13 02:48:48 +03:00
|
|
|
'octicon-lock': octiconLock,
|
Implement actions (#21937)
Close #13539.
Co-authored by: @lunny @appleboy @fuxiaohei and others.
Related projects:
- https://gitea.com/gitea/actions-proto-def
- https://gitea.com/gitea/actions-proto-go
- https://gitea.com/gitea/act
- https://gitea.com/gitea/act_runner
### Summary
The target of this PR is to bring a basic implementation of "Actions",
an internal CI/CD system of Gitea. That means even though it has been
merged, the state of the feature is **EXPERIMENTAL**, and please note
that:
- It is disabled by default;
- It shouldn't be used in a production environment currently;
- It shouldn't be used in a public Gitea instance currently;
- Breaking changes may be made before it's stable.
**Please comment on #13539 if you have any different product design
ideas**, all decisions reached there will be adopted here. But in this
PR, we don't talk about **naming, feature-creep or alternatives**.
### ⚠️ Breaking
`gitea-actions` will become a reserved user name. If a user with the
name already exists in the database, it is recommended to rename it.
### Some important reviews
- What is `DEFAULT_ACTIONS_URL` in `app.ini` for?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1055954954
- Why the api for runners is not under the normal `/api/v1` prefix?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1061173592
- Why DBFS?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1061301178
- Why ignore events triggered by `gitea-actions` bot?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1063254103
- Why there's no permission control for actions?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1090229868
### What it looks like
<details>
#### Manage runners
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205870657-c72f590e-2e08-4cd4-be7f-2e0abb299bbf.png">
#### List runs
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205872794-50fde990-2b45-48c1-a178-908e4ec5b627.png">
#### View logs
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205872501-9b7b9000-9542-4991-8f55-18ccdada77c3.png">
</details>
### How to try it
<details>
#### 1. Start Gitea
Clone this branch and [install from
source](https://docs.gitea.io/en-us/install-from-source).
Add additional configurations in `app.ini` to enable Actions:
```ini
[actions]
ENABLED = true
```
Start it.
If all is well, you'll see the management page of runners:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205877365-8e30a780-9b10-4154-b3e8-ee6c3cb35a59.png">
#### 2. Start runner
Clone the [act_runner](https://gitea.com/gitea/act_runner), and follow
the
[README](https://gitea.com/gitea/act_runner/src/branch/main/README.md)
to start it.
If all is well, you'll see a new runner has been added:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205878000-216f5937-e696-470d-b66c-8473987d91c3.png">
#### 3. Enable actions for a repo
Create a new repo or open an existing one, check the `Actions` checkbox
in settings and submit.
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205879705-53e09208-73c0-4b3e-a123-2dcf9aba4b9c.png">
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205879383-23f3d08f-1a85-41dd-a8b3-54e2ee6453e8.png">
If all is well, you'll see a new tab "Actions":
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205881648-a8072d8c-5803-4d76-b8a8-9b2fb49516c1.png">
#### 4. Upload workflow files
Upload some workflow files to `.gitea/workflows/xxx.yaml`, you can
follow the [quickstart](https://docs.github.com/en/actions/quickstart)
of GitHub Actions. Yes, Gitea Actions is compatible with GitHub Actions
in most cases, you can use the same demo:
```yaml
name: GitHub Actions Demo
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on: [push]
jobs:
Explore-GitHub-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 GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v3
- 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 }}."
```
If all is well, you'll see a new run in `Actions` tab:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205884473-79a874bc-171b-4aaf-acd5-0241a45c3b53.png">
#### 5. Check the logs of jobs
Click a run and you'll see the logs:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205884800-994b0374-67f7-48ff-be9a-4c53f3141547.png">
#### 6. Go on
You can try more examples in [the
documents](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions)
of GitHub Actions, then you might find a lot of bugs.
Come on, PRs are welcome.
</details>
See also: [Feature Preview: Gitea
Actions](https://blog.gitea.io/2022/12/feature-preview-gitea-actions/)
---------
Co-authored-by: a1012112796 <1012112796@qq.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: ChristopherHX <christopher.homberger@web.de>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2023-01-31 04:45:19 +03:00
|
|
|
'octicon-meter': octiconMeter,
|
2020-11-29 09:22:04 +03:00
|
|
|
'octicon-milestone': octiconMilestone,
|
2020-07-17 18:15:12 +03:00
|
|
|
'octicon-mirror': octiconMirror,
|
2023-05-01 01:02:56 +03:00
|
|
|
'octicon-organization': octiconOrganization,
|
2023-05-01 17:14:20 +03:00
|
|
|
'octicon-play': octiconPlay,
|
2023-05-01 01:02:56 +03:00
|
|
|
'octicon-plus': octiconPlus,
|
2020-11-29 09:22:04 +03:00
|
|
|
'octicon-project': octiconProject,
|
2023-05-03 08:23:39 +03:00
|
|
|
'octicon-quote': octiconQuote,
|
2020-07-13 02:48:48 +03:00
|
|
|
'octicon-repo': octiconRepo,
|
|
|
|
'octicon-repo-forked': octiconRepoForked,
|
|
|
|
'octicon-repo-template': octiconRepoTemplate,
|
2023-05-01 01:02:56 +03:00
|
|
|
'octicon-rss': octiconRss,
|
2023-05-03 08:23:39 +03:00
|
|
|
'octicon-screen-full': octiconScreenFull,
|
2023-05-01 01:02:56 +03:00
|
|
|
'octicon-search': octiconSearch,
|
2022-09-27 08:22:19 +03:00
|
|
|
'octicon-sidebar-collapse': octiconSidebarCollapse,
|
2022-12-02 12:42:34 +03:00
|
|
|
'octicon-sidebar-expand': octiconSidebarExpand,
|
Implement actions (#21937)
Close #13539.
Co-authored by: @lunny @appleboy @fuxiaohei and others.
Related projects:
- https://gitea.com/gitea/actions-proto-def
- https://gitea.com/gitea/actions-proto-go
- https://gitea.com/gitea/act
- https://gitea.com/gitea/act_runner
### Summary
The target of this PR is to bring a basic implementation of "Actions",
an internal CI/CD system of Gitea. That means even though it has been
merged, the state of the feature is **EXPERIMENTAL**, and please note
that:
- It is disabled by default;
- It shouldn't be used in a production environment currently;
- It shouldn't be used in a public Gitea instance currently;
- Breaking changes may be made before it's stable.
**Please comment on #13539 if you have any different product design
ideas**, all decisions reached there will be adopted here. But in this
PR, we don't talk about **naming, feature-creep or alternatives**.
### ⚠️ Breaking
`gitea-actions` will become a reserved user name. If a user with the
name already exists in the database, it is recommended to rename it.
### Some important reviews
- What is `DEFAULT_ACTIONS_URL` in `app.ini` for?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1055954954
- Why the api for runners is not under the normal `/api/v1` prefix?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1061173592
- Why DBFS?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1061301178
- Why ignore events triggered by `gitea-actions` bot?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1063254103
- Why there's no permission control for actions?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1090229868
### What it looks like
<details>
#### Manage runners
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205870657-c72f590e-2e08-4cd4-be7f-2e0abb299bbf.png">
#### List runs
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205872794-50fde990-2b45-48c1-a178-908e4ec5b627.png">
#### View logs
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205872501-9b7b9000-9542-4991-8f55-18ccdada77c3.png">
</details>
### How to try it
<details>
#### 1. Start Gitea
Clone this branch and [install from
source](https://docs.gitea.io/en-us/install-from-source).
Add additional configurations in `app.ini` to enable Actions:
```ini
[actions]
ENABLED = true
```
Start it.
If all is well, you'll see the management page of runners:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205877365-8e30a780-9b10-4154-b3e8-ee6c3cb35a59.png">
#### 2. Start runner
Clone the [act_runner](https://gitea.com/gitea/act_runner), and follow
the
[README](https://gitea.com/gitea/act_runner/src/branch/main/README.md)
to start it.
If all is well, you'll see a new runner has been added:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205878000-216f5937-e696-470d-b66c-8473987d91c3.png">
#### 3. Enable actions for a repo
Create a new repo or open an existing one, check the `Actions` checkbox
in settings and submit.
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205879705-53e09208-73c0-4b3e-a123-2dcf9aba4b9c.png">
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205879383-23f3d08f-1a85-41dd-a8b3-54e2ee6453e8.png">
If all is well, you'll see a new tab "Actions":
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205881648-a8072d8c-5803-4d76-b8a8-9b2fb49516c1.png">
#### 4. Upload workflow files
Upload some workflow files to `.gitea/workflows/xxx.yaml`, you can
follow the [quickstart](https://docs.github.com/en/actions/quickstart)
of GitHub Actions. Yes, Gitea Actions is compatible with GitHub Actions
in most cases, you can use the same demo:
```yaml
name: GitHub Actions Demo
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on: [push]
jobs:
Explore-GitHub-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 GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v3
- 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 }}."
```
If all is well, you'll see a new run in `Actions` tab:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205884473-79a874bc-171b-4aaf-acd5-0241a45c3b53.png">
#### 5. Check the logs of jobs
Click a run and you'll see the logs:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205884800-994b0374-67f7-48ff-be9a-4c53f3141547.png">
#### 6. Go on
You can try more examples in [the
documents](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions)
of GitHub Actions, then you might find a lot of bugs.
Come on, PRs are welcome.
</details>
See also: [Feature Preview: Gitea
Actions](https://blog.gitea.io/2022/12/feature-preview-gitea-actions/)
---------
Co-authored-by: a1012112796 <1012112796@qq.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: ChristopherHX <christopher.homberger@web.de>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2023-01-31 04:45:19 +03:00
|
|
|
'octicon-skip': octiconSkip,
|
2023-05-01 01:02:56 +03:00
|
|
|
'octicon-star': octiconStar,
|
2023-05-03 08:23:39 +03:00
|
|
|
'octicon-strikethrough': octiconStrikethrough,
|
Implement actions (#21937)
Close #13539.
Co-authored by: @lunny @appleboy @fuxiaohei and others.
Related projects:
- https://gitea.com/gitea/actions-proto-def
- https://gitea.com/gitea/actions-proto-go
- https://gitea.com/gitea/act
- https://gitea.com/gitea/act_runner
### Summary
The target of this PR is to bring a basic implementation of "Actions",
an internal CI/CD system of Gitea. That means even though it has been
merged, the state of the feature is **EXPERIMENTAL**, and please note
that:
- It is disabled by default;
- It shouldn't be used in a production environment currently;
- It shouldn't be used in a public Gitea instance currently;
- Breaking changes may be made before it's stable.
**Please comment on #13539 if you have any different product design
ideas**, all decisions reached there will be adopted here. But in this
PR, we don't talk about **naming, feature-creep or alternatives**.
### ⚠️ Breaking
`gitea-actions` will become a reserved user name. If a user with the
name already exists in the database, it is recommended to rename it.
### Some important reviews
- What is `DEFAULT_ACTIONS_URL` in `app.ini` for?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1055954954
- Why the api for runners is not under the normal `/api/v1` prefix?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1061173592
- Why DBFS?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1061301178
- Why ignore events triggered by `gitea-actions` bot?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1063254103
- Why there's no permission control for actions?
- https://github.com/go-gitea/gitea/pull/21937#discussion_r1090229868
### What it looks like
<details>
#### Manage runners
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205870657-c72f590e-2e08-4cd4-be7f-2e0abb299bbf.png">
#### List runs
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205872794-50fde990-2b45-48c1-a178-908e4ec5b627.png">
#### View logs
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205872501-9b7b9000-9542-4991-8f55-18ccdada77c3.png">
</details>
### How to try it
<details>
#### 1. Start Gitea
Clone this branch and [install from
source](https://docs.gitea.io/en-us/install-from-source).
Add additional configurations in `app.ini` to enable Actions:
```ini
[actions]
ENABLED = true
```
Start it.
If all is well, you'll see the management page of runners:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205877365-8e30a780-9b10-4154-b3e8-ee6c3cb35a59.png">
#### 2. Start runner
Clone the [act_runner](https://gitea.com/gitea/act_runner), and follow
the
[README](https://gitea.com/gitea/act_runner/src/branch/main/README.md)
to start it.
If all is well, you'll see a new runner has been added:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205878000-216f5937-e696-470d-b66c-8473987d91c3.png">
#### 3. Enable actions for a repo
Create a new repo or open an existing one, check the `Actions` checkbox
in settings and submit.
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205879705-53e09208-73c0-4b3e-a123-2dcf9aba4b9c.png">
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205879383-23f3d08f-1a85-41dd-a8b3-54e2ee6453e8.png">
If all is well, you'll see a new tab "Actions":
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205881648-a8072d8c-5803-4d76-b8a8-9b2fb49516c1.png">
#### 4. Upload workflow files
Upload some workflow files to `.gitea/workflows/xxx.yaml`, you can
follow the [quickstart](https://docs.github.com/en/actions/quickstart)
of GitHub Actions. Yes, Gitea Actions is compatible with GitHub Actions
in most cases, you can use the same demo:
```yaml
name: GitHub Actions Demo
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on: [push]
jobs:
Explore-GitHub-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 GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v3
- 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 }}."
```
If all is well, you'll see a new run in `Actions` tab:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205884473-79a874bc-171b-4aaf-acd5-0241a45c3b53.png">
#### 5. Check the logs of jobs
Click a run and you'll see the logs:
<img width="1792" alt="image"
src="https://user-images.githubusercontent.com/9418365/205884800-994b0374-67f7-48ff-be9a-4c53f3141547.png">
#### 6. Go on
You can try more examples in [the
documents](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions)
of GitHub Actions, then you might find a lot of bugs.
Come on, PRs are welcome.
</details>
See also: [Feature Preview: Gitea
Actions](https://blog.gitea.io/2022/12/feature-preview-gitea-actions/)
---------
Co-authored-by: a1012112796 <1012112796@qq.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: ChristopherHX <christopher.homberger@web.de>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2023-01-31 04:45:19 +03:00
|
|
|
'octicon-sync': octiconSync,
|
2023-05-03 08:23:39 +03:00
|
|
|
'octicon-table': octiconTable,
|
2023-05-01 01:02:56 +03:00
|
|
|
'octicon-tag': octiconTag,
|
2022-12-02 12:42:34 +03:00
|
|
|
'octicon-triangle-down': octiconTriangleDown,
|
|
|
|
'octicon-x': octiconX,
|
2023-05-01 01:02:56 +03:00
|
|
|
'octicon-x-circle-fill': octiconXCircleFill
|
2020-07-12 12:10:56 +03:00
|
|
|
};
|
|
|
|
|
2023-03-14 12:51:20 +03:00
|
|
|
// TODO: use a more general approach to access SVG icons.
|
|
|
|
// At the moment, developers must check, pick and fill the names manually,
|
|
|
|
// most of the SVG icons in assets couldn't be used directly.
|
2023-03-14 07:09:06 +03:00
|
|
|
|
2020-07-12 12:10:56 +03:00
|
|
|
const parser = new DOMParser();
|
|
|
|
const serializer = new XMLSerializer();
|
|
|
|
|
2023-03-14 07:09:06 +03:00
|
|
|
// retrieve an HTML string for given SVG icon name, size and additional classes
|
2020-11-29 09:22:04 +03:00
|
|
|
export function svg(name, size = 16, className = '') {
|
2023-03-14 07:09:06 +03:00
|
|
|
if (!(name in svgs)) throw new Error(`Unknown SVG icon: ${name}`);
|
2020-11-29 09:22:04 +03:00
|
|
|
if (size === 16 && !className) return svgs[name];
|
2020-07-12 12:10:56 +03:00
|
|
|
|
2020-11-29 09:22:04 +03:00
|
|
|
const document = parser.parseFromString(svgs[name], 'image/svg+xml');
|
|
|
|
const svgNode = document.firstChild;
|
2023-03-23 06:24:16 +03:00
|
|
|
if (size !== 16) {
|
|
|
|
svgNode.setAttribute('width', String(size));
|
|
|
|
svgNode.setAttribute('height', String(size));
|
|
|
|
}
|
2023-03-07 18:08:22 +03:00
|
|
|
if (className) svgNode.classList.add(...className.split(/\s+/).filter(Boolean));
|
2020-11-29 09:22:04 +03:00
|
|
|
return serializer.serializeToString(svgNode);
|
2020-07-12 12:10:56 +03:00
|
|
|
}
|
2021-07-13 21:09:19 +03:00
|
|
|
|
2023-03-23 06:24:16 +03:00
|
|
|
export function svgParseOuterInner(name) {
|
|
|
|
const svgStr = svgs[name];
|
|
|
|
if (!svgStr) throw new Error(`Unknown SVG icon: ${name}`);
|
|
|
|
|
|
|
|
// parse the SVG string to 2 parts
|
|
|
|
// * svgInnerHtml: the inner part of the SVG, will be used as the content of the <svg> VNode
|
|
|
|
// * svgOuter: the outer part of the SVG, including attributes
|
|
|
|
// the builtin SVG contents are clean, so it's safe to use `indexOf` to split the content:
|
|
|
|
// eg: <svg outer-attributes>${svgInnerHtml}</svg>
|
|
|
|
const p1 = svgStr.indexOf('>'), p2 = svgStr.lastIndexOf('<');
|
|
|
|
if (p1 === -1 || p2 === -1) throw new Error(`Invalid SVG icon: ${name}`);
|
|
|
|
const svgInnerHtml = svgStr.slice(p1 + 1, p2);
|
|
|
|
const svgOuterHtml = svgStr.slice(0, p1 + 1) + svgStr.slice(p2);
|
|
|
|
const svgDoc = parser.parseFromString(svgOuterHtml, 'image/svg+xml');
|
|
|
|
const svgOuter = svgDoc.firstChild;
|
|
|
|
return {svgOuter, svgInnerHtml};
|
|
|
|
}
|
|
|
|
|
2022-10-01 17:26:38 +03:00
|
|
|
export const SvgIcon = {
|
|
|
|
name: 'SvgIcon',
|
2021-07-13 21:09:19 +03:00
|
|
|
props: {
|
|
|
|
name: {type: String, required: true},
|
|
|
|
size: {type: Number, default: 16},
|
|
|
|
className: {type: String, default: ''},
|
|
|
|
},
|
2023-03-14 12:51:20 +03:00
|
|
|
render() {
|
2023-03-23 06:24:16 +03:00
|
|
|
const {svgOuter, svgInnerHtml} = svgParseOuterInner(this.name);
|
|
|
|
// https://vuejs.org/guide/extras/render-function.html#creating-vnodes
|
|
|
|
// the `^` is used for attr, set SVG attributes like 'width', `aria-hidden`, `viewBox`, etc
|
|
|
|
const attrs = {};
|
|
|
|
for (const attr of svgOuter.attributes) {
|
|
|
|
if (attr.name === 'class') continue;
|
|
|
|
attrs[`^${attr.name}`] = attr.value;
|
|
|
|
}
|
|
|
|
attrs[`^width`] = this.size;
|
|
|
|
attrs[`^height`] = this.size;
|
|
|
|
|
|
|
|
// make the <SvgIcon class="foo" class-name="bar"> classes work together
|
|
|
|
const classes = [];
|
|
|
|
for (const cls of svgOuter.classList) {
|
|
|
|
classes.push(cls);
|
|
|
|
}
|
|
|
|
// TODO: drop the `className/class-name` prop in the future, only use "class" prop
|
|
|
|
if (this.className) {
|
|
|
|
classes.push(...this.className.split(/\s+/).filter(Boolean));
|
|
|
|
}
|
|
|
|
|
|
|
|
// create VNode
|
|
|
|
return h('svg', {
|
|
|
|
...attrs,
|
|
|
|
class: classes,
|
|
|
|
innerHTML: svgInnerHtml,
|
|
|
|
});
|
2021-07-13 21:09:19 +03:00
|
|
|
},
|
2022-10-01 17:26:38 +03:00
|
|
|
};
|