Skip to content

Commit 3ee6b0f

Browse files
authored
Automatically push releases to GCS (#1318)
1 parent e270f7d commit 3ee6b0f

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

.drone.yml

+40
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@ steps:
6666
when:
6767
event: tag
6868

69+
- name: publish:gcs
70+
image: plugins/gcs
71+
settings:
72+
source: gcs_bucket
73+
target: codesrv-ci.cdr.sh/
74+
token:
75+
from_secret: gcs-token
76+
when:
77+
event: tag
78+
6979
---
7080
kind: pipeline
7181
type: docker
@@ -120,6 +130,16 @@ steps:
120130
when:
121131
event: tag
122132

133+
- name: publish:gcs
134+
image: plugins/gcs
135+
settings:
136+
source: gcs_bucket
137+
target: codesrv-ci.cdr.sh/
138+
token:
139+
from_secret: gcs-token
140+
when:
141+
event: tag
142+
123143
---
124144
kind: pipeline
125145
type: docker
@@ -188,6 +208,16 @@ steps:
188208
when:
189209
event: tag
190210

211+
- name: publish:gcs
212+
image: plugins/gcs
213+
settings:
214+
source: gcs_bucket
215+
target: codesrv-ci.cdr.sh/
216+
token:
217+
from_secret: gcs-token
218+
when:
219+
event: tag
220+
191221
---
192222
kind: pipeline
193223
type: docker
@@ -242,6 +272,16 @@ steps:
242272
when:
243273
event: tag
244274

275+
- name: publish:gcs
276+
image: plugins/gcs
277+
settings:
278+
source: gcs_bucket
279+
target: codesrv-ci.cdr.sh/
280+
token:
281+
from_secret: gcs-token
282+
when:
283+
event: tag
284+
245285
---
246286
kind: pipeline
247287
type: docker

scripts/ci.bash

+24
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@
33

44
set -euo pipefail
55

6+
function target() {
7+
local os=$(uname | tr '[:upper:]' '[:lower:]')
8+
if [[ "$os" == "linux" ]]; then
9+
# Using the same strategy to detect Alpine as build.ts.
10+
local ldd_output=$(ldd --version 2>&1 || true)
11+
if echo "$ldd_output" | grep -iq musl; then
12+
os="alpine"
13+
fi
14+
fi
15+
16+
echo "${os}-$(uname -m)"
17+
}
18+
619
function main() {
720
cd "$(dirname "${0}")/.."
821

@@ -44,6 +57,17 @@ function main() {
4457
if [[ -n ${BINARY:-} ]] ; then
4558
mv binaries/code-server*-vsc* binaries/code-server
4659
fi
60+
61+
# Prepare GCS bucket directory on release.
62+
if [[ -n ${DRONE_TAG:-} || -n ${TRAVIS_TAG:-} ]] ; then
63+
local gcp_dir="gcs_bucket/releases/$code_server_version/$(target)"
64+
65+
mkdir -p "$gcp_dir"
66+
mv binaries/code-server*-vsc* "$gcp_dir"
67+
if [[ "$(target)" == "linux-x86_64" ]] ; then
68+
mv binaries/code-server*-vsc* "gcs_bucket/latest-linux"
69+
fi
70+
fi
4771
}
4872

4973
main "$@"

0 commit comments

Comments
 (0)