Automatically push releases to GCS (#1318)

This commit is contained in:
Dean Sheather 2020-02-05 03:32:45 +10:00 committed by GitHub
parent e270f7da1b
commit 3ee6b0ff0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 64 additions and 0 deletions

View File

@ -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
@ -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
@ -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
@ -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

View File

@ -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}")/.."
@ -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 "$@"