Skip to content

Commit 4ea38bb

Browse files
GiteaBottechknowlogicksilverwind
authored
Build nightly binaries with Actions (#25308) (#25314)
Backport #25308 by @techknowlogick Co-authored-by: techknowlogick <[email protected]> Co-authored-by: silverwind <[email protected]>
1 parent 25cb1fb commit 4ea38bb

File tree

5 files changed

+61
-147
lines changed

5 files changed

+61
-147
lines changed

.drone.yml

Lines changed: 0 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -1,138 +1,3 @@
1-
---
2-
kind: pipeline
3-
type: docker
4-
name: release-latest
5-
6-
platform:
7-
os: linux
8-
arch: amd64
9-
10-
workspace:
11-
base: /source
12-
path: /
13-
14-
trigger:
15-
branch:
16-
- main
17-
- "release/*"
18-
event:
19-
- push
20-
paths:
21-
exclude:
22-
- "docs/**"
23-
24-
volumes:
25-
- name: deps
26-
temp: {}
27-
28-
steps:
29-
- name: fetch-tags
30-
image: docker:git
31-
pull: always
32-
commands:
33-
- git fetch --tags --force
34-
35-
- name: deps-frontend
36-
image: node:20
37-
pull: always
38-
commands:
39-
- make deps-frontend
40-
41-
- name: deps-backend
42-
image: gitea/test_env:linux-1.20-amd64
43-
pull: always
44-
commands:
45-
- make deps-backend
46-
volumes:
47-
- name: deps
48-
path: /go
49-
50-
- name: static
51-
image: techknowlogick/xgo:go-1.20.x
52-
pull: always
53-
commands:
54-
# Upgrade to node 20 once https://github.com/techknowlogick/xgo/issues/163 is resolved
55-
- curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get -qqy install nodejs
56-
- export PATH=$PATH:$GOPATH/bin
57-
- make release
58-
environment:
59-
GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not
60-
TAGS: bindata sqlite sqlite_unlock_notify
61-
DEBIAN_FRONTEND: noninteractive
62-
volumes:
63-
- name: deps
64-
path: /go
65-
66-
- name: gpg-sign
67-
image: plugins/gpgsign:1
68-
pull: always
69-
settings:
70-
detach_sign: true
71-
excludes:
72-
- "dist/release/*.sha256"
73-
files:
74-
- "dist/release/*"
75-
environment:
76-
GPGSIGN_KEY:
77-
from_secret: gpgsign_key
78-
GPGSIGN_PASSPHRASE:
79-
from_secret: gpgsign_passphrase
80-
81-
- name: release-branch
82-
image: woodpeckerci/plugin-s3:latest
83-
pull: always
84-
settings:
85-
acl:
86-
from_secret: aws_s3_acl
87-
region:
88-
from_secret: aws_s3_region
89-
bucket:
90-
from_secret: aws_s3_bucket
91-
endpoint:
92-
from_secret: aws_s3_endpoint
93-
path_style:
94-
from_secret: aws_s3_path_style
95-
source: "dist/release/*"
96-
strip_prefix: dist/release/
97-
target: "/gitea/${DRONE_BRANCH##release/v}"
98-
environment:
99-
AWS_ACCESS_KEY_ID:
100-
from_secret: aws_access_key_id
101-
AWS_SECRET_ACCESS_KEY:
102-
from_secret: aws_secret_access_key
103-
when:
104-
branch:
105-
- "release/*"
106-
event:
107-
- push
108-
109-
- name: release-main
110-
image: woodpeckerci/plugin-s3:latest
111-
settings:
112-
acl:
113-
from_secret: aws_s3_acl
114-
region:
115-
from_secret: aws_s3_region
116-
bucket:
117-
from_secret: aws_s3_bucket
118-
endpoint:
119-
from_secret: aws_s3_endpoint
120-
path_style:
121-
from_secret: aws_s3_path_style
122-
source: "dist/release/*"
123-
strip_prefix: dist/release/
124-
target: /gitea/main
125-
environment:
126-
AWS_ACCESS_KEY_ID:
127-
from_secret: aws_access_key_id
128-
AWS_SECRET_ACCESS_KEY:
129-
from_secret: aws_secret_access_key
130-
when:
131-
branch:
132-
- main
133-
event:
134-
- push
135-
1361
---
1372
kind: pipeline
1383
name: release-version

.github/workflows/cron-licenses.yml

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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/release-nightly.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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-buildx-action@v1
59+
# build for linux/amd64, and linux/arm64 (possibly include linux/arm/v7 later. not included now because it adds significant amount to the build time)

Makefile

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -831,30 +831,18 @@ release-windows: | $(DIST_DIRS)
831831
ifeq (,$(findstring gogit,$(TAGS)))
832832
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 .
833833
endif
834-
ifeq ($(CI),true)
835-
cp /build/* $(DIST)/binaries
836-
endif
837834

838835
.PHONY: release-linux
839836
release-linux: | $(DIST_DIRS)
840837
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) .
841-
ifeq ($(CI),true)
842-
cp /build/* $(DIST)/binaries
843-
endif
844838

845839
.PHONY: release-darwin
846840
release-darwin: | $(DIST_DIRS)
847841
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) .
848-
ifeq ($(CI),true)
849-
cp /build/* $(DIST)/binaries
850-
endif
851842

852843
.PHONY: release-freebsd
853844
release-freebsd: | $(DIST_DIRS)
854845
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) .
855-
ifeq ($(CI),true)
856-
cp /build/* $(DIST)/binaries
857-
endif
858846

859847
.PHONY: release-copy
860848
release-copy: | $(DIST_DIRS)

0 commit comments

Comments
 (0)