Skip to content

Commit 5eceb8d

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: (22 commits) Only run `docker-dryrun` when necessary (go-gitea#25329) fix a nit error output in Makefile (go-gitea#25360) [skip ci] Updated translations via Crowdin Clean up pyproject.toml and package.json, fix poetry options (go-gitea#25327) Fix label list divider (go-gitea#25312) Avoid polluting the config (go-gitea#25345) Fix incorrect link-action event target (go-gitea#25306) Write absolute AppDataPath to app.ini when installing (go-gitea#25331) Add Exoscale to installation on cloud provider docs (go-gitea#25342) Fix UI on mobile view (go-gitea#25315) When viewing a file, hide the add button (go-gitea#25320) Update JS dependencies, remove space after emoji completion (go-gitea#25266) Refactor web package and context package (go-gitea#25298) build nightly docker images (go-gitea#25317) Add `stylelint-declaration-block-no-ignored-properties` (go-gitea#25284) Remove EasyMDE focus outline on text (go-gitea#25328) use Actions environment variables in Makefile (go-gitea#25319) add `stylelint-stylistic` (go-gitea#25285) Remove more unused Fomantic variants (go-gitea#25292) Build nightly binaries with Actions (go-gitea#25308) ...
2 parents 9b5b943 + 51c2aeb commit 5eceb8d

File tree

118 files changed

+1451
-3295
lines changed

Some content is hidden

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

118 files changed

+1451
-3295
lines changed

.drone.yml

-439
Large diffs are not rendered by default.

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
/templates/swagger/v1_json.tmpl linguist-generated
66
/vendor/** -text -eol linguist-vendored
77
/web_src/fomantic/build/** linguist-generated
8+
/web_src/fomantic/_site/globals/site.variables linguist-language=Less
89
/web_src/js/vendor/** -text -eol linguist-vendored
910
Dockerfile.* linguist-language=Dockerfile

.github/workflows/cron-licenses.yml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: cron-licenses
33
on:
44
schedule:
55
- cron: "7 0 * * 1" # every Monday at 00:07 UTC
6+
workflow_dispatch:
67

78
jobs:
89
cron-licenses:

.github/workflows/cron-translations.yml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: cron-translations
33
on:
44
schedule:
55
- cron: "7 0 * * *" # every day at 00:07 UTC
6+
workflow_dispatch:
67

78
jobs:
89
crowdin-pull:

.github/workflows/files-changed.yml

+8-6
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,20 @@ on:
44
workflow_call:
55
outputs:
66
backend:
7-
description: "whether backend files changed"
87
value: ${{ jobs.detect.outputs.backend }}
98
frontend:
10-
description: "whether frontend files changed"
119
value: ${{ jobs.detect.outputs.frontend }}
1210
docs:
13-
description: "whether docs files changed"
1411
value: ${{ jobs.detect.outputs.docs }}
1512
actions:
16-
description: "whether actions files changed"
1713
value: ${{ jobs.detect.outputs.actions }}
1814
templates:
19-
description: "whether templates files changed"
2015
value: ${{ jobs.detect.outputs.templates }}
16+
docker:
17+
value: ${{ jobs.detect.outputs.docker }}
2118

2219
jobs:
2320
detect:
24-
name: detect which files changed
2521
runs-on: ubuntu-latest
2622
timeout-minutes: 3
2723
# Map a step output to a job output
@@ -31,6 +27,7 @@ jobs:
3127
docs: ${{ steps.changes.outputs.docs }}
3228
actions: ${{ steps.changes.outputs.actions }}
3329
templates: ${{ steps.changes.outputs.templates }}
30+
docker: ${{ steps.changes.outputs.docker }}
3431
steps:
3532
- uses: actions/checkout@v3
3633
- uses: dorny/paths-filter@v2
@@ -58,3 +55,8 @@ jobs:
5855
5956
templates:
6057
- "templates/**/*.tmpl"
58+
- "poetry.lock"
59+
docker:
60+
- "Dockerfile"
61+
- "Dockerfile.rootless"
62+
- "docker/**"

.github/workflows/pull-docker-dryrun.yml

+14-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111
files-changed:
1212
uses: ./.github/workflows/files-changed.yml
1313

14-
docker-dryrun:
15-
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.frontend == 'true' || needs.files-changed.outputs.actions == 'true'
14+
regular:
15+
if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.actions == 'true'
1616
needs: files-changed
1717
runs-on: ubuntu-latest
1818
steps:
@@ -21,3 +21,15 @@ jobs:
2121
with:
2222
push: false
2323
tags: gitea/gitea:linux-amd64
24+
25+
rootless:
26+
if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.actions == 'true'
27+
needs: files-changed
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: docker/setup-buildx-action@v2
31+
- uses: docker/build-push-action@v4
32+
with:
33+
push: false
34+
file: Dockerfile.rootless
35+
tags: gitea/gitea:linux-amd64

.github/workflows/release-nightly.yml

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: release-nightly-assets
2+
3+
on:
4+
push:
5+
branches: [ main, release/v* ]
6+
7+
jobs:
8+
nightly-binary:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
# fetch all commits instead of only the last as some branches are long lived and could have many between versions
13+
# fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567
14+
- run: git fetch --unshallow --quiet --tags --force
15+
- uses: actions/setup-go@v4
16+
with:
17+
go-version: ">=1.20"
18+
check-latest: true
19+
- uses: actions/setup-node@v3
20+
with:
21+
node-version: 20
22+
- run: make deps-frontend deps-backend
23+
# xgo build
24+
- run: make release
25+
env:
26+
TAGS: bindata sqlite sqlite_unlock_notify
27+
- name: import gpg key
28+
id: import_gpg
29+
uses: crazy-max/ghaction-import-gpg@v5
30+
with:
31+
gpg_private_key: ${{ secrets.GPGSIGN_KEY }}
32+
passphrase: ${{ secrets.GPGSIGN_PASSPHRASE }}
33+
- name: sign binaries
34+
run: |
35+
for f in dist/release/*; do
36+
echo '${{ secrets.GPGSIGN_PASSPHRASE }}' | gpg --pinentry-mode loopback --passphrase-fd 0 --batch --yes --detach-sign -u ${{ steps.import_gpg.outputs.fingerprint }} --output "$f.asc" "$f"
37+
done
38+
# clean branch name to get the folder name in S3
39+
- name: Get cleaned branch name
40+
id: clean_name
41+
run: |
42+
REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\///' -e 's/release\/v//')
43+
echo "Cleaned name is ${REF_NAME}"
44+
echo "branch=${REF_NAME}" >> "$GITHUB_OUTPUT"
45+
- name: upload binaries to s3
46+
uses: jakejarvis/s3-sync-action@master
47+
env:
48+
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
49+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
50+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
51+
AWS_REGION: ${{ secrets.AWS_REGION }}
52+
SOURCE_DIR: dist/release
53+
DEST_DIR: gitea/${{ steps.clean_name.outputs.branch }}
54+
nightly-docker:
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@v3
58+
- uses: docker/setup-qemu-action@v2
59+
- uses: docker/setup-buildx-action@v2
60+
- name: Get cleaned branch name
61+
id: clean_name
62+
run: |
63+
# if main then say nightly otherwise cleanup name
64+
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
65+
echo "branch=nightly" >> "$GITHUB_OUTPUT"
66+
exit 0
67+
fi
68+
REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\///' -e 's/release\/v//')
69+
echo "branch=${REF_NAME}-nightly" >> "$GITHUB_OUTPUT"
70+
- name: Login to Docker Hub
71+
uses: docker/login-action@v2
72+
with:
73+
username: ${{ secrets.DOCKERHUB_USERNAME }}
74+
password: ${{ secrets.DOCKERHUB_TOKEN }}
75+
- name: build rootful docker image
76+
uses: docker/build-push-action@v4
77+
with:
78+
platforms: linux/amd64,linux/arm64
79+
push: true
80+
tags: gitea/gitea:${{ steps.clean_name.outputs.branch }}
81+
- name: build rootless docker image
82+
uses: docker/build-push-action@v4
83+
with:
84+
platforms: linux/amd64,linux/arm64
85+
push: true
86+
file: Dockerfile.rootless
87+
tags: gitea/gitea:${{ steps.clean_name.outputs.branch }}-rootless

.stylelintrc.yaml

+80
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
plugins:
22
- stylelint-declaration-strict-value
3+
- stylelint-declaration-block-no-ignored-properties
4+
- stylelint-stylistic
35

46
ignoreFiles:
57
- "**/*.go"
@@ -80,6 +82,7 @@ rules:
8082
media-feature-name-no-vendor-prefix: true
8183
media-feature-name-unit-allowed-list: null
8284
media-feature-name-value-allowed-list: null
85+
media-feature-name-value-no-unknown: true
8386
media-feature-range-notation: null
8487
named-grid-areas-no-invalid: true
8588
no-descending-specificity: null
@@ -92,6 +95,7 @@ rules:
9295
no-unknown-animations: null
9396
no-unknown-custom-properties: null
9497
number-max-precision: null
98+
plugin/declaration-block-no-ignored-properties: true
9599
property-allowed-list: null
96100
property-disallowed-list: null
97101
property-no-unknown: true
@@ -132,6 +136,82 @@ rules:
132136
selector-type-no-unknown: [true, {ignore: [custom-elements]}]
133137
shorthand-property-no-redundant-values: true
134138
string-no-newline: true
139+
stylistic/at-rule-name-case: null
140+
stylistic/at-rule-name-newline-after: null
141+
stylistic/at-rule-name-space-after: null
142+
stylistic/at-rule-semicolon-newline-after: null
143+
stylistic/at-rule-semicolon-space-before: null
144+
stylistic/block-closing-brace-empty-line-before: null
145+
stylistic/block-closing-brace-newline-after: null
146+
stylistic/block-closing-brace-newline-before: null
147+
stylistic/block-closing-brace-space-after: null
148+
stylistic/block-closing-brace-space-before: null
149+
stylistic/block-opening-brace-newline-after: null
150+
stylistic/block-opening-brace-newline-before: null
151+
stylistic/block-opening-brace-space-after: null
152+
stylistic/block-opening-brace-space-before: null
153+
stylistic/color-hex-case: lower
154+
stylistic/declaration-bang-space-after: never
155+
stylistic/declaration-bang-space-before: null
156+
stylistic/declaration-block-semicolon-newline-after: null
157+
stylistic/declaration-block-semicolon-newline-before: null
158+
stylistic/declaration-block-semicolon-space-after: null
159+
stylistic/declaration-block-semicolon-space-before: never
160+
stylistic/declaration-block-trailing-semicolon: null
161+
stylistic/declaration-colon-newline-after: null
162+
stylistic/declaration-colon-space-after: null
163+
stylistic/declaration-colon-space-before: never
164+
stylistic/function-comma-newline-after: null
165+
stylistic/function-comma-newline-before: null
166+
stylistic/function-comma-space-after: null
167+
stylistic/function-comma-space-before: null
168+
stylistic/function-max-empty-lines: 0
169+
stylistic/function-parentheses-newline-inside: never-multi-line
170+
stylistic/function-parentheses-space-inside: null
171+
stylistic/function-whitespace-after: null
172+
stylistic/indentation: 2
173+
stylistic/linebreaks: null
174+
stylistic/max-empty-lines: 1
175+
stylistic/max-line-length: null
176+
stylistic/media-feature-colon-space-after: null
177+
stylistic/media-feature-colon-space-before: never
178+
stylistic/media-feature-name-case: null
179+
stylistic/media-feature-parentheses-space-inside: null
180+
stylistic/media-feature-range-operator-space-after: always
181+
stylistic/media-feature-range-operator-space-before: always
182+
stylistic/media-query-list-comma-newline-after: null
183+
stylistic/media-query-list-comma-newline-before: null
184+
stylistic/media-query-list-comma-space-after: null
185+
stylistic/media-query-list-comma-space-before: null
186+
stylistic/no-empty-first-line: null
187+
stylistic/no-eol-whitespace: true
188+
stylistic/no-extra-semicolons: true
189+
stylistic/no-missing-end-of-source-newline: null
190+
stylistic/number-leading-zero: null
191+
stylistic/number-no-trailing-zeros: null
192+
stylistic/property-case: lower
193+
stylistic/selector-attribute-brackets-space-inside: null
194+
stylistic/selector-attribute-operator-space-after: null
195+
stylistic/selector-attribute-operator-space-before: null
196+
stylistic/selector-combinator-space-after: null
197+
stylistic/selector-combinator-space-before: null
198+
stylistic/selector-descendant-combinator-no-non-space: null
199+
stylistic/selector-list-comma-newline-after: null
200+
stylistic/selector-list-comma-newline-before: null
201+
stylistic/selector-list-comma-space-after: always-single-line
202+
stylistic/selector-list-comma-space-before: never-single-line
203+
stylistic/selector-max-empty-lines: 0
204+
stylistic/selector-pseudo-class-case: lower
205+
stylistic/selector-pseudo-class-parentheses-space-inside: never
206+
stylistic/selector-pseudo-element-case: lower
207+
stylistic/string-quotes: double
208+
stylistic/unicode-bom: null
209+
stylistic/unit-case: lower
210+
stylistic/value-list-comma-newline-after: null
211+
stylistic/value-list-comma-newline-before: null
212+
stylistic/value-list-comma-space-after: null
213+
stylistic/value-list-comma-space-before: null
214+
stylistic/value-list-max-empty-lines: 0
135215
time-min-milliseconds: null
136216
unit-allowed-list: null
137217
unit-disallowed-list: null

Makefile

+6-18
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ endif
6868

6969
EXTRA_GOFLAGS ?=
7070

71-
MAKE_VERSION := $(shell "$(MAKE)" -v | head -n 1)
71+
MAKE_VERSION := $(shell "$(MAKE)" -v | cat | head -n 1)
7272
MAKE_EVIDENCE_DIR := .make_evidence
7373

7474
ifeq ($(RACE_ENABLED),true)
@@ -79,12 +79,12 @@ endif
7979
STORED_VERSION_FILE := VERSION
8080
HUGO_VERSION ?= 0.111.3
8181

82-
ifneq ($(DRONE_TAG),)
83-
VERSION ?= $(subst v,,$(DRONE_TAG))
84-
GITEA_VERSION ?= $(VERSION)
82+
ifneq ($(GITHUB_REF_TYPE),branch)
83+
VERSION ?= $(subst v,,$(GITHUB_REF_NAME))
84+
GITEA_VERSION ?= $(GITHUB_REF_NAME)
8585
else
86-
ifneq ($(DRONE_BRANCH),)
87-
VERSION ?= $(subst release/v,,$(DRONE_BRANCH))
86+
ifneq ($(GITHUB_REF_NAME),)
87+
VERSION ?= $(subst release/v,,$(GITHUB_REF_NAME))
8888
else
8989
VERSION ?= main
9090
endif
@@ -837,30 +837,18 @@ release-windows: | $(DIST_DIRS)
837837
ifeq (,$(findstring gogit,$(TAGS)))
838838
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -buildmode exe -dest $(DIST)/binaries -tags 'osusergo gogit $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets 'windows/*' -out gitea-$(VERSION)-gogit .
839839
endif
840-
ifeq ($(CI),true)
841-
cp /build/* $(DIST)/binaries
842-
endif
843840

844841
.PHONY: release-linux
845842
release-linux: | $(DIST_DIRS)
846843
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '-linkmode external -extldflags "-static" $(LDFLAGS)' -targets '$(LINUX_ARCHS)' -out gitea-$(VERSION) .
847-
ifeq ($(CI),true)
848-
cp /build/* $(DIST)/binaries
849-
endif
850844

851845
.PHONY: release-darwin
852846
release-darwin: | $(DIST_DIRS)
853847
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '$(LDFLAGS)' -targets 'darwin-10.12/amd64,darwin-10.12/arm64' -out gitea-$(VERSION) .
854-
ifeq ($(CI),true)
855-
cp /build/* $(DIST)/binaries
856-
endif
857848

858849
.PHONY: release-freebsd
859850
release-freebsd: | $(DIST_DIRS)
860851
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) run $(XGO_PACKAGE) -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '$(LDFLAGS)' -targets 'freebsd/amd64' -out gitea-$(VERSION) .
861-
ifeq ($(CI),true)
862-
cp /build/* $(DIST)/binaries
863-
endif
864852

865853
.PHONY: release-copy
866854
release-copy: | $(DIST_DIRS)

cmd/web.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ func runWeb(ctx *cli.Context) error {
191191
}
192192

193193
// Set up Chi routes
194-
c := routers.NormalRoutes(graceful.GetManager().HammerContext())
194+
c := routers.NormalRoutes()
195195
err := listen(c, true)
196196
<-graceful.GetManager().Done()
197197
log.Info("PID: %d Gitea Web Finished", os.Getpid())

docs/content/doc/installation/on-cloud-provider.en-us.md

+10
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,13 @@ To deploy Gitea to Linode, have a look at the [Linode Marketplace](https://www.l
5656
[alwaysdata](https://www.alwaysdata.com/) has Gitea as an app in their marketplace.
5757

5858
To deploy Gitea to alwaysdata, have a look at the [alwaysdata Marketplace](https://www.alwaysdata.com/en/marketplace/gitea/).
59+
60+
## Exoscale
61+
62+
[Exoscale](https://www.exoscale.com/) provides Gitea managed by [Glasskube](https://glasskube.eu/) in their marketplace.
63+
64+
Exoscale is a European cloud service provider.
65+
66+
The package is maintained and update via the open source [Glasskube Kubernetes Operator](https://github.com/glasskube/operator).
67+
68+
To deploy Gitea to Exoscale, have a look at the [Exoscale Marketplace](https://www.exoscale.com/marketplace/listing/glasskube-gitea/).

modules/context/api.go

+8
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import (
2020
"code.gitea.io/gitea/modules/httpcache"
2121
"code.gitea.io/gitea/modules/log"
2222
"code.gitea.io/gitea/modules/setting"
23+
"code.gitea.io/gitea/modules/web"
24+
web_types "code.gitea.io/gitea/modules/web/types"
2325

2426
"gitea.com/go-chi/cache"
2527
)
@@ -41,6 +43,12 @@ type APIContext struct {
4143
Package *Package
4244
}
4345

46+
func init() {
47+
web.RegisterResponseStatusProvider[*APIContext](func(req *http.Request) web_types.ResponseStatusProvider {
48+
return req.Context().Value(apiContextKey).(*APIContext)
49+
})
50+
}
51+
4452
// Currently, we have the following common fields in error response:
4553
// * message: the message for end users (it shouldn't be used for error type detection)
4654
// if we need to indicate some errors, we should introduce some new fields like ErrorCode or ErrorType

0 commit comments

Comments
 (0)