File tree Expand file tree Collapse file tree 4 files changed +95
-4
lines changed Expand file tree Collapse file tree 4 files changed +95
-4
lines changed Original file line number Diff line number Diff line change
1
+ name : Go Release
2
+ on :
3
+ push :
4
+ tags :
5
+ - ' v*'
6
+ jobs :
7
+ release :
8
+ runs-on : ubuntu-latest
9
+ permissions :
10
+ contents : write
11
+ steps :
12
+ - name : Checkout code
13
+ uses : actions/checkout@v4
14
+ - name : Set up Go
15
+ uses : actions/setup-go@v5
16
+ with :
17
+ go-version : ' 1.25'
18
+ - name : Build releases
19
+ run : make releases
20
+ - name : Create GitHub Release
21
+ id : create_release
22
+ uses : softprops/action-gh-release@v2
23
+ with :
24
+ files : dist/*.tar.gz
Original file line number Diff line number Diff line change
1
+ name : Go Test
2
+ on :
3
+ push :
4
+ branches : [ "main" ]
5
+ paths :
6
+ - ' **.go'
7
+ - ' go.mod'
8
+ pull_request :
9
+ branches : [ "main" ]
10
+ paths :
11
+ - ' **.go'
12
+ - ' go.mod'
13
+
14
+ jobs :
15
+ test :
16
+ runs-on : ubuntu-latest
17
+
18
+ steps :
19
+ - name : Checkout code
20
+ uses : actions/checkout@v4
21
+
22
+ - name : Set up Go
23
+ uses : actions/setup-go@v5
24
+ with :
25
+ go-version : ' 1.25'
26
+
27
+ - name : Install dependencies
28
+ run : go mod download
29
+
30
+ - name : Run tests with coverage
31
+ run : go test -v -coverprofile=coverage.txt ./...
32
+
33
+ - uses : codecov/codecov-action@v5
34
+ with :
35
+ files : ./coverage.txt
36
+ token : ${{ secrets.CODECOV_TOKEN }}
Original file line number Diff line number Diff line change @@ -61,4 +61,6 @@ fabric.properties
61
61
* .vsix
62
62
63
63
config-local.yaml
64
- gitea-pages
64
+ gitea-pages
65
+ * .zip
66
+ dist /
Original file line number Diff line number Diff line change 1
1
GOPATH := $(shell go env GOPATH)
2
+ GOARCH ?= $(shell go env GOARCH)
3
+ GOOS ?= $(shell go env GOOS)
4
+
5
+
6
+ ifeq ($(GOOS ) ,windows)
7
+ GO_DIST_NAME := gitea-pages.exe
8
+ else
9
+ GO_DIST_NAME := gitea-pages
10
+ endif
2
11
3
12
fmt :
4
13
@ (test -f " $( GOPATH) /bin/gofumpt" || go install mvdan.cc/gofumpt@latest) && \
5
14
" $( GOPATH) /bin/gofumpt" -l -w .
6
15
16
+
17
+ .PHONY : release
18
+ release : dist/gitea-pages-$(GOOS ) -$(GOARCH ) .tar.gz
19
+
20
+ dist/gitea-pages-$(GOOS ) -$(GOARCH ) .tar.gz : $(shell find . -type f -name "* .go" ) go.mod go.sum
21
+ @echo Compile $@ via $(GO_DIST_NAME ) && \
22
+ mkdir -p dist && \
23
+ rm -f dist/$(GO_DIST_NAME ) && \
24
+ GOOS=$(GOOS ) GOARCH=$(GOARCH ) CGO_ENABLED=0 go build -trimpath -ldflags=" -s -w" -o dist/$(GO_DIST_NAME ) . && \
25
+ cd dist && \
26
+ tar zcf gitea-pages-$(GOOS ) -$(GOARCH ) .tar.gz $(GO_DIST_NAME ) ../LICENSE ../config.yaml ../errors.html.tmpl ../README.md ../README_* .md && \
27
+ rm -f $(GO_DIST_NAME )
28
+
7
29
gitea-pages : $(shell find . -type f -name "* .go" ) go.mod go.sum
8
- @CGO_ENABLED=0 go build -ldflags=" -s -w" -o $@ .
30
+ @CGO_ENABLED=0 go build -trimpath - ldflags=" -s -w" -o $@ .
9
31
10
32
.PHONY : debug
11
-
12
33
debug : gitea-pages
13
34
@./gitea-pages -conf config-local.yaml -debug
14
35
15
36
.PHONY : test
16
37
test :
17
- @go test -v ./...
38
+ @go test -v ./...
39
+
40
+
41
+ .PHONY : releases
42
+ releases :
43
+ @make release GOOS=linux GOARCH=amd64 && \
44
+ make release GOOS=linux GOARCH=arm64 && \
45
+ make release GOOS=linux GOARCH=loong64 && \
46
+ make release GOOS=windows GOARCH=amd64
You can’t perform that action at this time.
0 commit comments