Skip to content

Commit 6dfd20f

Browse files
committed
Merge branch 'main' of https://github.com/go-gitea/gitea into feature-cran
2 parents dad233d + 6ff5400 commit 6dfd20f

File tree

98 files changed

+2274
-911
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+2274
-911
lines changed

Diff for: custom/conf/app.example.ini

+2
Original file line numberDiff line numberDiff line change
@@ -2518,6 +2518,8 @@ ROUTER = console
25182518
;LIMIT_SIZE_PYPI = -1
25192519
;; Maximum size of a RubyGems upload (`-1` means no limits, format `1000`, `1 MB`, `1 GiB`)
25202520
;LIMIT_SIZE_RUBYGEMS = -1
2521+
;; Maximum size of a Swift upload (`-1` means no limits, format `1000`, `1 MB`, `1 GiB`)
2522+
;LIMIT_SIZE_SWIFT = -1
25212523
;; Maximum size of a Vagrant upload (`-1` means no limits, format `1000`, `1 MB`, `1 GiB`)
25222524
;LIMIT_SIZE_VAGRANT = -1
25232525

Diff for: docs/content/doc/advanced/config-cheat-sheet.en-us.md

+1
Original file line numberDiff line numberDiff line change
@@ -1255,6 +1255,7 @@ Task queue configuration has been moved to `queue.task`. However, the below conf
12551255
- `LIMIT_SIZE_PUB`: **-1**: Maximum size of a Pub upload (`-1` means no limits, format `1000`, `1 MB`, `1 GiB`)
12561256
- `LIMIT_SIZE_PYPI`: **-1**: Maximum size of a PyPI upload (`-1` means no limits, format `1000`, `1 MB`, `1 GiB`)
12571257
- `LIMIT_SIZE_RUBYGEMS`: **-1**: Maximum size of a RubyGems upload (`-1` means no limits, format `1000`, `1 MB`, `1 GiB`)
1258+
- `LIMIT_SIZE_SWIFT`: **-1**: Maximum size of a Swift upload (`-1` means no limits, format `1000`, `1 MB`, `1 GiB`)
12581259
- `LIMIT_SIZE_VAGRANT`: **-1**: Maximum size of a Vagrant upload (`-1` means no limits, format `1000`, `1 MB`, `1 GiB`)
12591260

12601261
## Mirror (`mirror`)

Diff for: docs/content/doc/features/localization.zh-cn.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,18 @@ menu:
1515

1616
# 本地化
1717

18-
## TBD
18+
Gitea的本地化是通过我们的[Crowdin项目](https://crowdin.com/project/gitea)进行的。
19+
20+
对于对**英语翻译**的更改,可以发出pull-request,来更改[英语语言环境](https://github.com/go-gitea/gitea/blob/master/options/locale/locale_en-US.ini)中合适的关键字。
21+
22+
有关对**非英语**翻译的更改,请参阅上面的 Crowdin 项目。
23+
24+
## 支持的语言
25+
26+
上述 Crowdin 项目中列出的任何语言一旦翻译了 25% 或更多都将得到支持。
27+
28+
翻译被接受后,它将在下一次 Crowdin 同步后反映在主存储库中,这通常是在任何 PR 合并之后。
29+
30+
在撰写本文时,这意味着更改后的翻译可能要到 Gitea 的下一个版本才会出现。
31+
32+
如果使用开发版本,则在同步更改内容后,它应该会在更新后立即显示。

Diff for: docs/content/doc/packages/overview.en-us.md

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ The following package managers are currently supported:
4141
| [Pub]({{< relref "doc/packages/pub.en-us.md" >}}) | Dart | `dart`, `flutter` |
4242
| [PyPI]({{< relref "doc/packages/pypi.en-us.md" >}}) | Python | `pip`, `twine` |
4343
| [RubyGems]({{< relref "doc/packages/rubygems.en-us.md" >}}) | Ruby | `gem`, `Bundler` |
44+
| [Swift]({{< relref "doc/packages/rubygems.en-us.md" >}}) | Swift | `swift` |
4445
| [Vagrant]({{< relref "doc/packages/vagrant.en-us.md" >}}) | - | `vagrant` |
4546

4647
**The following paragraphs only apply if Packages are not globally disabled!**

Diff for: docs/content/doc/packages/swift.en-us.md

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
date: "2023-01-10T00:00:00+00:00"
3+
title: "Swift Packages Repository"
4+
slug: "packages/swift"
5+
draft: false
6+
toc: false
7+
menu:
8+
sidebar:
9+
parent: "packages"
10+
name: "Swift"
11+
weight: 95
12+
identifier: "swift"
13+
---
14+
15+
# Swift Packages Repository
16+
17+
Publish [Swift](hhttps://www.swift.org/) packages for your user or organization.
18+
19+
**Table of Contents**
20+
21+
{{< toc >}}
22+
23+
## Requirements
24+
25+
To work with the Swift package registry, you need to use [swift](https://www.swift.org/getting-started/) to consume and a HTTP client (like `curl`) to publish packages.
26+
27+
## Configuring the package registry
28+
29+
To register the package registry and provide credentials, execute:
30+
31+
```shell
32+
swift package-registry set https://gitea.example.com/api/packages/{owner}/swift -login {username} -password {password}
33+
```
34+
35+
| Placeholder | Description |
36+
| ------------ | ----------- |
37+
| `owner` | The owner of the package. |
38+
| `username` | Your Gitea username. |
39+
| `password` | Your Gitea password. If you are using 2FA or OAuth use a [personal access token]({{< relref "doc/developers/api-usage.en-us.md#authentication" >}}) instead of the password. |
40+
41+
The login is optional and only needed if the package registry is private.
42+
43+
## Publish a package
44+
45+
First you have to pack the contents of your package:
46+
47+
```shell
48+
swift package archive-source
49+
```
50+
51+
To publish the package perform a HTTP PUT request with the package content in the request body.
52+
53+
```shell --user your_username:your_password_or_token \
54+
curl -X PUT --user {username}:{password} \
55+
-H "Accept: application/vnd.swift.registry.v1+json" \
56+
-F source-archive=@/path/to/package.zip \
57+
-F metadata={metadata} \
58+
https://gitea.example.com/api/packages/{owner}/swift/{scope}/{name}/{version}
59+
```
60+
61+
| Placeholder | Description |
62+
| ----------- | ----------- |
63+
| `username` | Your Gitea username. |
64+
| `password` | Your Gitea password. If you are using 2FA or OAuth use a [personal access token]({{< relref "doc/developers/api-usage.en-us.md#authentication" >}}) instead of the password. |
65+
| `owner` | The owner of the package. |
66+
| `scope` | The package scope. |
67+
| `name` | The package name. |
68+
| `version` | The package version. |
69+
| `metadata` | (Optional) The metadata of the package. JSON encoded subset of https://schema.org/SoftwareSourceCode |
70+
71+
You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first.
72+
73+
## Install a package
74+
75+
To install a Swift package from the package registry, add it in the `Package.swift` file dependencies list:
76+
77+
```
78+
dependencies: [
79+
.package(id: "{scope}.{name}", from:"{version}")
80+
]
81+
```
82+
83+
| Parameter | Description |
84+
| ----------- | ----------- |
85+
| `scope` | The package scope. |
86+
| `name` | The package name. |
87+
| `version` | The package version. |
88+
89+
Afterwards execute the following command to install it:
90+
91+
```shell
92+
swift package resolve
93+
```

Diff for: models/actions/run.go

+11
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,17 @@ func (run *ActionRun) GetPushEventPayload() (*api.PushPayload, error) {
128128
return nil, fmt.Errorf("event %s is not a push event", run.Event)
129129
}
130130

131+
func (run *ActionRun) GetPullRequestEventPayload() (*api.PullRequestPayload, error) {
132+
if run.Event == webhook_module.HookEventPullRequest {
133+
var payload api.PullRequestPayload
134+
if err := json.Unmarshal([]byte(run.EventPayload), &payload); err != nil {
135+
return nil, err
136+
}
137+
return &payload, nil
138+
}
139+
return nil, fmt.Errorf("event %s is not a pull request event", run.Event)
140+
}
141+
131142
func updateRepoRunsNumbers(ctx context.Context, repo *repo_model.Repository) error {
132143
_, err := db.GetEngine(ctx).ID(repo.ID).
133144
SetExpr("num_action_runs",

Diff for: models/packages/descriptor.go

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"code.gitea.io/gitea/modules/packages/pub"
2626
"code.gitea.io/gitea/modules/packages/pypi"
2727
"code.gitea.io/gitea/modules/packages/rubygems"
28+
"code.gitea.io/gitea/modules/packages/swift"
2829
"code.gitea.io/gitea/modules/packages/vagrant"
2930

3031
"github.com/hashicorp/go-version"
@@ -162,6 +163,8 @@ func GetPackageDescriptor(ctx context.Context, pv *PackageVersion) (*PackageDesc
162163
metadata = &pypi.Metadata{}
163164
case TypeRubyGems:
164165
metadata = &rubygems.Metadata{}
166+
case TypeSwift:
167+
metadata = &swift.Metadata{}
165168
case TypeVagrant:
166169
metadata = &vagrant.Metadata{}
167170
default:

Diff for: models/packages/package.go

+6
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const (
4545
TypePub Type = "pub"
4646
TypePyPI Type = "pypi"
4747
TypeRubyGems Type = "rubygems"
48+
TypeSwift Type = "swift"
4849
TypeVagrant Type = "vagrant"
4950
)
5051

@@ -64,6 +65,7 @@ var TypeList = []Type{
6465
TypePub,
6566
TypePyPI,
6667
TypeRubyGems,
68+
TypeSwift,
6769
TypeVagrant,
6870
}
6971

@@ -100,6 +102,8 @@ func (pt Type) Name() string {
100102
return "PyPI"
101103
case TypeRubyGems:
102104
return "RubyGems"
105+
case TypeSwift:
106+
return "Swift"
103107
case TypeVagrant:
104108
return "Vagrant"
105109
}
@@ -139,6 +143,8 @@ func (pt Type) SVGName() string {
139143
return "gitea-python"
140144
case TypeRubyGems:
141145
return "gitea-rubygems"
146+
case TypeSwift:
147+
return "gitea-swift"
142148
case TypeVagrant:
143149
return "gitea-vagrant"
144150
}

Diff for: modules/context/pagination.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ type Pagination struct {
1818
urlParams []string
1919
}
2020

21-
// NewPagination creates a new instance of the Pagination struct
22-
func NewPagination(total, page, issueNum, numPages int) *Pagination {
21+
// NewPagination creates a new instance of the Pagination struct.
22+
// "pagingNum" is "page size" or "limit", "current" is "page"
23+
func NewPagination(total, pagingNum, current, numPages int) *Pagination {
2324
p := &Pagination{}
24-
p.Paginater = paginator.New(total, page, issueNum, numPages)
25+
p.Paginater = paginator.New(total, pagingNum, current, numPages)
2526
return p
2627
}
2728

0 commit comments

Comments
 (0)