Skip to content

Automatically push releases to GCS #1318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ steps:
when:
event: tag

- name: publish:gcs
image: plugins/gcs
settings:
source: gcs_bucket
target: codesrv-ci.cdr.sh/
token:
from_secret: gcs-token
when:
event: tag

---
kind: pipeline
type: docker
Expand Down Expand Up @@ -120,6 +130,16 @@ steps:
when:
event: tag

- name: publish:gcs
image: plugins/gcs
settings:
source: gcs_bucket
target: codesrv-ci.cdr.sh/
token:
from_secret: gcs-token
when:
event: tag

---
kind: pipeline
type: docker
Expand Down Expand Up @@ -188,6 +208,16 @@ steps:
when:
event: tag

- name: publish:gcs
image: plugins/gcs
settings:
source: gcs_bucket
target: codesrv-ci.cdr.sh/
token:
from_secret: gcs-token
when:
event: tag

---
kind: pipeline
type: docker
Expand Down Expand Up @@ -242,6 +272,16 @@ steps:
when:
event: tag

- name: publish:gcs
image: plugins/gcs
settings:
source: gcs_bucket
target: codesrv-ci.cdr.sh/
token:
from_secret: gcs-token
when:
event: tag

---
kind: pipeline
type: docker
Expand Down
24 changes: 24 additions & 0 deletions scripts/ci.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@

set -euo pipefail

function target() {
local os=$(uname | tr '[:upper:]' '[:lower:]')
if [[ "$os" == "linux" ]]; then
# Using the same strategy to detect Alpine as build.ts.
local ldd_output=$(ldd --version 2>&1 || true)
if echo "$ldd_output" | grep -iq musl; then
os="alpine"
fi
fi

echo "${os}-$(uname -m)"
}

function main() {
cd "$(dirname "${0}")/.."

Expand Down Expand Up @@ -44,6 +57,17 @@ function main() {
if [[ -n ${BINARY:-} ]] ; then
mv binaries/code-server*-vsc* binaries/code-server
fi

# Prepare GCS bucket directory on release.
if [[ -n ${DRONE_TAG:-} || -n ${TRAVIS_TAG:-} ]] ; then
local gcp_dir="gcs_bucket/releases/$code_server_version/$(target)"

mkdir -p "$gcp_dir"
mv binaries/code-server*-vsc* "$gcp_dir"
if [[ "$(target)" == "linux-x86_64" ]] ; then
mv binaries/code-server*-vsc* "gcs_bucket/latest-linux"
fi
fi
}

main "$@"