2023-03-14 15:21:20 +05:30
|
|
|
import {h} from 'vue';
|
2023-10-11 18:04:21 +05:30
|
|
|
import {parseDom, serializeXml} from './utils.js';
|
2023-07-18 21:36:43 +05:30
|
|
|
import giteaDoubleChevronLeft from '../../public/assets/img/svg/gitea-double-chevron-left.svg';
|
|
|
|
import giteaDoubleChevronRight from '../../public/assets/img/svg/gitea-double-chevron-right.svg';
|
|
|
|
import giteaEmptyCheckbox from '../../public/assets/img/svg/gitea-empty-checkbox.svg';
|
|
|
|
import giteaExclamation from '../../public/assets/img/svg/gitea-exclamation.svg';
|
|
|
|
import octiconArchive from '../../public/assets/img/svg/octicon-archive.svg';
|
|
|
|
import octiconArrowSwitch from '../../public/assets/img/svg/octicon-arrow-switch.svg';
|
|
|
|
import octiconBlocked from '../../public/assets/img/svg/octicon-blocked.svg';
|
|
|
|
import octiconBold from '../../public/assets/img/svg/octicon-bold.svg';
|
|
|
|
import octiconCheck from '../../public/assets/img/svg/octicon-check.svg';
|
|
|
|
import octiconCheckbox from '../../public/assets/img/svg/octicon-checkbox.svg';
|
|
|
|
import octiconCheckCircleFill from '../../public/assets/img/svg/octicon-check-circle-fill.svg';
|
|
|
|
import octiconChevronDown from '../../public/assets/img/svg/octicon-chevron-down.svg';
|
|
|
|
import octiconChevronLeft from '../../public/assets/img/svg/octicon-chevron-left.svg';
|
|
|
|
import octiconChevronRight from '../../public/assets/img/svg/octicon-chevron-right.svg';
|
|
|
|
import octiconClock from '../../public/assets/img/svg/octicon-clock.svg';
|
|
|
|
import octiconCode from '../../public/assets/img/svg/octicon-code.svg';
|
|
|
|
import octiconColumns from '../../public/assets/img/svg/octicon-columns.svg';
|
|
|
|
import octiconCopy from '../../public/assets/img/svg/octicon-copy.svg';
|
|
|
|
import octiconDiffAdded from '../../public/assets/img/svg/octicon-diff-added.svg';
|
|
|
|
import octiconDiffModified from '../../public/assets/img/svg/octicon-diff-modified.svg';
|
|
|
|
import octiconDiffRemoved from '../../public/assets/img/svg/octicon-diff-removed.svg';
|
|
|
|
import octiconDiffRenamed from '../../public/assets/img/svg/octicon-diff-renamed.svg';
|
|
|
|
import octiconDotFill from '../../public/assets/img/svg/octicon-dot-fill.svg';
|
|
|
|
import octiconDownload from '../../public/assets/img/svg/octicon-download.svg';
|
|
|
|
import octiconEye from '../../public/assets/img/svg/octicon-eye.svg';
|
|
|
|
import octiconFile from '../../public/assets/img/svg/octicon-file.svg';
|
|
|
|
import octiconFileDirectoryFill from '../../public/assets/img/svg/octicon-file-directory-fill.svg';
|
|
|
|
import octiconFilter from '../../public/assets/img/svg/octicon-filter.svg';
|
|
|
|
import octiconGear from '../../public/assets/img/svg/octicon-gear.svg';
|
|
|
|
import octiconGitBranch from '../../public/assets/img/svg/octicon-git-branch.svg';
|
2023-07-29 00:48:12 +05:30
|
|
|
import octiconGitCommit from '../../public/assets/img/svg/octicon-git-commit.svg';
|
2023-07-18 21:36:43 +05:30
|
|
|
import octiconGitMerge from '../../public/assets/img/svg/octicon-git-merge.svg';
|
|
|
|
import octiconGitPullRequest from '../../public/assets/img/svg/octicon-git-pull-request.svg';
|
2024-02-05 04:07:45 +05:30
|
|
|
import octiconGitPullRequestDraft from '../../public/assets/img/svg/octicon-git-pull-request-draft.svg';
|
2023-07-18 21:36:43 +05:30
|
|
|
import octiconHeading from '../../public/assets/img/svg/octicon-heading.svg';
|
|
|
|
import octiconHorizontalRule from '../../public/assets/img/svg/octicon-horizontal-rule.svg';
|
|
|
|
import octiconImage from '../../public/assets/img/svg/octicon-image.svg';
|
|
|
|
import octiconIssueClosed from '../../public/assets/img/svg/octicon-issue-closed.svg';
|
|
|
|
import octiconIssueOpened from '../../public/assets/img/svg/octicon-issue-opened.svg';
|
|
|
|
import octiconItalic from '../../public/assets/img/svg/octicon-italic.svg';
|
|
|
|
import octiconKebabHorizontal from '../../public/assets/img/svg/octicon-kebab-horizontal.svg';
|
|
|
|
import octiconLink from '../../public/assets/img/svg/octicon-link.svg';
|
|
|
|
import octiconListOrdered from '../../public/assets/img/svg/octicon-list-ordered.svg';
|
|
|
|
import octiconListUnordered from '../../public/assets/img/svg/octicon-list-unordered.svg';
|
|
|
|
import octiconLock from '../../public/assets/img/svg/octicon-lock.svg';
|
|
|
|
import octiconMeter from '../../public/assets/img/svg/octicon-meter.svg';
|
|
|
|
import octiconMilestone from '../../public/assets/img/svg/octicon-milestone.svg';
|
|
|
|
import octiconMirror from '../../public/assets/img/svg/octicon-mirror.svg';
|
|
|
|
import octiconOrganization from '../../public/assets/img/svg/octicon-organization.svg';
|
|
|
|
import octiconPlay from '../../public/assets/img/svg/octicon-play.svg';
|
|
|
|
import octiconPlus from '../../public/assets/img/svg/octicon-plus.svg';
|
|
|
|
import octiconProject from '../../public/assets/img/svg/octicon-project.svg';
|
|
|
|
import octiconQuote from '../../public/assets/img/svg/octicon-quote.svg';
|
|
|
|
import octiconRepo from '../../public/assets/img/svg/octicon-repo.svg';
|
|
|
|
import octiconRepoForked from '../../public/assets/img/svg/octicon-repo-forked.svg';
|
|
|
|
import octiconRepoTemplate from '../../public/assets/img/svg/octicon-repo-template.svg';
|
|
|
|
import octiconRss from '../../public/assets/img/svg/octicon-rss.svg';
|
|
|
|
import octiconScreenFull from '../../public/assets/img/svg/octicon-screen-full.svg';
|
|
|
|
import octiconSearch from '../../public/assets/img/svg/octicon-search.svg';
|
|
|
|
import octiconSidebarCollapse from '../../public/assets/img/svg/octicon-sidebar-collapse.svg';
|
|
|
|
import octiconSidebarExpand from '../../public/assets/img/svg/octicon-sidebar-expand.svg';
|
|
|
|
import octiconSkip from '../../public/assets/img/svg/octicon-skip.svg';
|
|
|
|
import octiconStar from '../../public/assets/img/svg/octicon-star.svg';
|
|
|
|
import octiconStrikethrough from '../../public/assets/img/svg/octicon-strikethrough.svg';
|
|
|
|
import octiconSync from '../../public/assets/img/svg/octicon-sync.svg';
|
|
|
|
import octiconTable from '../../public/assets/img/svg/octicon-table.svg';
|
|
|
|
import octiconTag from '../../public/assets/img/svg/octicon-tag.svg';
|
2024-02-18 16:03:50 +05:30
|
|
|
import octiconTrash from '../../public/assets/img/svg/octicon-trash.svg';
|
2023-07-18 21:36:43 +05:30
|
|
|
import octiconTriangleDown from '../../public/assets/img/svg/octicon-triangle-down.svg';
|
|
|
|
import octiconX from '../../public/assets/img/svg/octicon-x.svg';
|
|
|
|
import octiconXCircleFill from '../../public/assets/img/svg/octicon-x-circle-fill.svg';
|
2022-09-27 10:52:19 +05:30
|
|
|
|
2023-03-14 09:39:06 +05:30
|
|
|
const svgs = {
|
2023-05-03 10:53:39 +05:30
|
|
|
'gitea-double-chevron-left': giteaDoubleChevronLeft,
|
|
|
|
'gitea-double-chevron-right': giteaDoubleChevronRight,
|
|
|
|
'gitea-empty-checkbox': giteaEmptyCheckbox,
|
2023-05-14 03:29:01 +05:30
|
|
|
'gitea-exclamation': giteaExclamation,
|
2023-05-01 03:32:56 +05:30
|
|
|
'octicon-archive': octiconArchive,
|
2023-05-03 10:53:39 +05:30
|
|
|
'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 07:15:19 +05:30
|
|
|
'octicon-blocked': octiconBlocked,
|
2023-05-03 10:53:39 +05:30
|
|
|
'octicon-bold': octiconBold,
|
2023-05-14 03:29:01 +05:30
|
|
|
'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 07:15:19 +05:30
|
|
|
'octicon-check-circle-fill': octiconCheckCircleFill,
|
2023-05-03 10:53:39 +05:30
|
|
|
'octicon-checkbox': octiconCheckbox,
|
2020-07-13 18:51:19 +05:30
|
|
|
'octicon-chevron-down': octiconChevronDown,
|
2023-05-01 03:32:56 +05:30
|
|
|
'octicon-chevron-left': octiconChevronLeft,
|
2020-07-13 18:51:19 +05:30
|
|
|
'octicon-chevron-right': octiconChevronRight,
|
2022-06-11 20:14:20 +05:30
|
|
|
'octicon-clock': octiconClock,
|
2023-05-03 10:53:39 +05:30
|
|
|
'octicon-code': octiconCode,
|
|
|
|
'octicon-columns': octiconColumns,
|
2022-12-02 15:12:34 +05:30
|
|
|
'octicon-copy': octiconCopy,
|
|
|
|
'octicon-diff-added': octiconDiffAdded,
|
|
|
|
'octicon-diff-modified': octiconDiffModified,
|
|
|
|
'octicon-diff-removed': octiconDiffRemoved,
|
|
|
|
'octicon-diff-renamed': octiconDiffRenamed,
|
2023-05-14 03:29:01 +05:30
|
|
|
'octicon-dot-fill': octiconDotFill,
|
2023-06-29 08:28:56 +05:30
|
|
|
'octicon-download': octiconDownload,
|
2023-05-03 10:53:39 +05:30
|
|
|
'octicon-eye': octiconEye,
|
2022-12-02 15:12:34 +05:30
|
|
|
'octicon-file': octiconFile,
|
|
|
|
'octicon-file-directory-fill': octiconFileDirectoryFill,
|
2023-05-01 03:32:56 +05:30
|
|
|
'octicon-filter': octiconFilter,
|
2023-05-31 02:08:55 +05:30
|
|
|
'octicon-gear': octiconGear,
|
2023-05-01 03:32:56 +05:30
|
|
|
'octicon-git-branch': octiconGitBranch,
|
2023-07-29 00:48:12 +05:30
|
|
|
'octicon-git-commit': octiconGitCommit,
|
2020-07-12 14:40:56 +05:30
|
|
|
'octicon-git-merge': octiconGitMerge,
|
|
|
|
'octicon-git-pull-request': octiconGitPullRequest,
|
2024-02-05 04:07:45 +05:30
|
|
|
'octicon-git-pull-request-draft': octiconGitPullRequestDraft,
|
2023-05-03 10:53:39 +05:30
|
|
|
'octicon-heading': octiconHeading,
|
|
|
|
'octicon-horizontal-rule': octiconHorizontalRule,
|
|
|
|
'octicon-image': octiconImage,
|
2020-07-12 14:40:56 +05:30
|
|
|
'octicon-issue-closed': octiconIssueClosed,
|
|
|
|
'octicon-issue-opened': octiconIssueOpened,
|
2023-05-03 10:53:39 +05:30
|
|
|
'octicon-italic': octiconItalic,
|
2021-05-19 08:46:02 +05:30
|
|
|
'octicon-kebab-horizontal': octiconKebabHorizontal,
|
2020-07-12 14:40:56 +05:30
|
|
|
'octicon-link': octiconLink,
|
2023-05-03 10:53:39 +05:30
|
|
|
'octicon-list-ordered': octiconListOrdered,
|
|
|
|
'octicon-list-unordered': octiconListUnordered,
|
2020-07-13 05:18:48 +05:30
|
|
|
'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 07:15:19 +05:30
|
|
|
'octicon-meter': octiconMeter,
|
2020-11-29 11:52:04 +05:30
|
|
|
'octicon-milestone': octiconMilestone,
|
2020-07-17 20:45:12 +05:30
|
|
|
'octicon-mirror': octiconMirror,
|
2023-05-01 03:32:56 +05:30
|
|
|
'octicon-organization': octiconOrganization,
|
2023-05-01 19:44:20 +05:30
|
|
|
'octicon-play': octiconPlay,
|
2023-05-01 03:32:56 +05:30
|
|
|
'octicon-plus': octiconPlus,
|
2020-11-29 11:52:04 +05:30
|
|
|
'octicon-project': octiconProject,
|
2023-05-03 10:53:39 +05:30
|
|
|
'octicon-quote': octiconQuote,
|
2020-07-13 05:18:48 +05:30
|
|
|
'octicon-repo': octiconRepo,
|
|
|
|
'octicon-repo-forked': octiconRepoForked,
|
|
|
|
'octicon-repo-template': octiconRepoTemplate,
|
2023-05-01 03:32:56 +05:30
|
|
|
'octicon-rss': octiconRss,
|
2023-05-03 10:53:39 +05:30
|
|
|
'octicon-screen-full': octiconScreenFull,
|
2023-05-01 03:32:56 +05:30
|
|
|
'octicon-search': octiconSearch,
|
2022-09-27 10:52:19 +05:30
|
|
|
'octicon-sidebar-collapse': octiconSidebarCollapse,
|
2022-12-02 15:12:34 +05:30
|
|
|
'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 07:15:19 +05:30
|
|
|
'octicon-skip': octiconSkip,
|
2023-05-01 03:32:56 +05:30
|
|
|
'octicon-star': octiconStar,
|
2023-05-03 10:53:39 +05:30
|
|
|
'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 07:15:19 +05:30
|
|
|
'octicon-sync': octiconSync,
|
2023-05-03 10:53:39 +05:30
|
|
|
'octicon-table': octiconTable,
|
2023-05-01 03:32:56 +05:30
|
|
|
'octicon-tag': octiconTag,
|
2024-02-18 16:03:50 +05:30
|
|
|
'octicon-trash': octiconTrash,
|
2022-12-02 15:12:34 +05:30
|
|
|
'octicon-triangle-down': octiconTriangleDown,
|
|
|
|
'octicon-x': octiconX,
|
2023-05-31 02:08:55 +05:30
|
|
|
'octicon-x-circle-fill': octiconXCircleFill,
|
2020-07-12 14:40:56 +05:30
|
|
|
};
|
|
|
|
|
2023-03-14 15:21:20 +05:30
|
|
|
// 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 09:39:06 +05:30
|
|
|
|
|
|
|
// retrieve an HTML string for given SVG icon name, size and additional classes
|
2020-11-29 11:52:04 +05:30
|
|
|
export function svg(name, size = 16, className = '') {
|
2023-03-14 09:39:06 +05:30
|
|
|
if (!(name in svgs)) throw new Error(`Unknown SVG icon: ${name}`);
|
2020-11-29 11:52:04 +05:30
|
|
|
if (size === 16 && !className) return svgs[name];
|
2020-07-12 14:40:56 +05:30
|
|
|
|
2023-10-11 18:04:21 +05:30
|
|
|
const document = parseDom(svgs[name], 'image/svg+xml');
|
2020-11-29 11:52:04 +05:30
|
|
|
const svgNode = document.firstChild;
|
2023-03-23 08:54:16 +05:30
|
|
|
if (size !== 16) {
|
|
|
|
svgNode.setAttribute('width', String(size));
|
|
|
|
svgNode.setAttribute('height', String(size));
|
|
|
|
}
|
2023-03-07 20:38:22 +05:30
|
|
|
if (className) svgNode.classList.add(...className.split(/\s+/).filter(Boolean));
|
2023-10-11 18:04:21 +05:30
|
|
|
return serializeXml(svgNode);
|
2020-07-12 14:40:56 +05:30
|
|
|
}
|
2021-07-13 23:39:19 +05:30
|
|
|
|
2023-03-23 08:54:16 +05:30
|
|
|
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);
|
2023-10-11 18:04:21 +05:30
|
|
|
const svgDoc = parseDom(svgOuterHtml, 'image/svg+xml');
|
2023-03-23 08:54:16 +05:30
|
|
|
const svgOuter = svgDoc.firstChild;
|
|
|
|
return {svgOuter, svgInnerHtml};
|
|
|
|
}
|
|
|
|
|
2022-10-01 19:56:38 +05:30
|
|
|
export const SvgIcon = {
|
|
|
|
name: 'SvgIcon',
|
2021-07-13 23:39:19 +05:30
|
|
|
props: {
|
|
|
|
name: {type: String, required: true},
|
|
|
|
size: {type: Number, default: 16},
|
|
|
|
className: {type: String, default: ''},
|
2024-03-22 19:36:53 +05:30
|
|
|
symbolId: {type: String},
|
2021-07-13 23:39:19 +05:30
|
|
|
},
|
2023-03-14 15:21:20 +05:30
|
|
|
render() {
|
2023-07-21 16:50:04 +05:30
|
|
|
let {svgOuter, svgInnerHtml} = svgParseOuterInner(this.name);
|
2023-03-23 08:54:16 +05:30
|
|
|
// 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 = [];
|
2024-03-21 19:35:24 +05:30
|
|
|
for (const cls of svgOuter.classList.values()) {
|
2023-03-23 08:54:16 +05:30
|
|
|
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));
|
|
|
|
}
|
2023-07-21 16:50:04 +05:30
|
|
|
if (this.symbolId) {
|
|
|
|
classes.push('gt-hidden', 'svg-symbol-container');
|
|
|
|
svgInnerHtml = `<symbol id="${this.symbolId}" viewBox="${attrs['^viewBox']}">${svgInnerHtml}</symbol>`;
|
|
|
|
}
|
2023-03-23 08:54:16 +05:30
|
|
|
// create VNode
|
|
|
|
return h('svg', {
|
|
|
|
...attrs,
|
|
|
|
class: classes,
|
|
|
|
innerHTML: svgInnerHtml,
|
|
|
|
});
|
2021-07-13 23:39:19 +05:30
|
|
|
},
|
2022-10-01 19:56:38 +05:30
|
|
|
};
|