diff --git a/.travis.yml b/.travis.yml index b67ccc62..603b00a2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,20 +12,26 @@ jobs: - stage: Release name: Linux Release - script: travis_wait 60 ./ci/image/run.sh "yarn && yarn vscode && ci/release.sh" + script: + - travis_wait 60 ./ci/image/run.sh "yarn && yarn vscode && ci/release.sh" + - ./ci/release-image/push.sh - name: Linux ARM64 Release - script: travis_wait 60 ./ci/image/run.sh "yarn && yarn vscode && ci/release.sh" + script: + - travis_wait 60 ./ci/image/run.sh "yarn && yarn vscode && ci/release.sh" + - ./ci/release-image/push.sh arch: arm64 - name: MacOS Release os: osx language: node_js node_js: 12 script: yarn && yarn vscode && travis_wait 60 ci/release.sh + - name: Docker Release + script: ./ci/release-image/push.sh stages: - name: Code - name: Release - if: $TRAVIS_TAG != "" + if: env(TRAVIS_TAG) IS present deploy: - provider: releases diff --git a/ci/image/run.sh b/ci/image/run.sh index 3ac16e5a..6dd3f261 100755 --- a/ci/image/run.sh +++ b/ci/image/run.sh @@ -4,6 +4,8 @@ set -euo pipefail main() { cd "$(dirname "$0")/../.." + + docker build ci/image imageTag="$(docker build -q ci/image)" docker run -t --rm -e CI -e GITHUB_TOKEN -v "$(yarn cache dir):/usr/local/share/.cache/yarn/v6" -v "$PWD:/repo" -w /repo "$imageTag" "$*" } diff --git a/ci/release-image/.gitignore b/ci/release-image/.gitignore deleted file mode 100644 index c9cabf53..00000000 --- a/ci/release-image/.gitignore +++ /dev/null @@ -1 +0,0 @@ -code-server*.tar.gz diff --git a/ci/release-image/Dockerfile b/ci/release-image/Dockerfile index 751230e0..95d75587 100644 --- a/ci/release-image/Dockerfile +++ b/ci/release-image/Dockerfile @@ -3,7 +3,7 @@ FROM debian:10 RUN apt-get update RUN apt-get install -y curl -COPY code-server*.tar.gz /tmp +COPY release/code-server*.tar.gz /tmp RUN cd /tmp && tar -xzf code-server*.tar.gz && \ cp code-server*/code-server /usr/local/bin/code-server RUN rm -rf /tmp/* diff --git a/ci/release-image/push.sh b/ci/release-image/push.sh new file mode 100755 index 00000000..88924612 --- /dev/null +++ b/ci/release-image/push.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +set -euo pipefail + +main() { + cd "$(dirname "$0")/../.." + + if [[ ${CI:-} ]]; then + echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + fi + + imageTag="codercom/code-server:$VERSION" + latest="codercom/code-server:latest" + if [[ $TRAVIS_CPU_ARCH == "arm64" ]]; then + imageTag+="-arm64" + latest="codercom/code-server:arm64" + fi + docker build -t "$imageTag" -t "$latest" -f ./ci/release-image/Dockerfile + docker push codercom/code-server +} + +main "$@"