mirror of
https://github.com/coder/code-server.git
synced 2025-07-30 21:45:08 +08:00
Implement new structure
This commit is contained in:
@ -8,46 +8,48 @@ set -eu
|
||||
|
||||
# Try restoring from each argument in turn until we get something.
|
||||
restore() {
|
||||
for branch in "$@" ; do
|
||||
if [ -n "$branch" ] ; then
|
||||
cache_path="https://codesrv-ci.cdr.sh/cache/$branch/$tar.tar.gz"
|
||||
if wget "$cache_path" ; then
|
||||
tar xzvf "$tar.tar.gz"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
for branch in "$@" ; do
|
||||
if [ -n "$branch" ] ; then
|
||||
cache_path="https://codesrv-ci.cdr.sh/cache/$branch/$tar.tar.gz"
|
||||
if wget "$cache_path" ; then
|
||||
tar xzvf "$tar.tar.gz"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# We need to cache the built-in extensions and Node modules. Everything inside
|
||||
# the cache-upload directory will be uploaded as-is to the code-server bucket.
|
||||
package() {
|
||||
mkdir -p "cache-upload/cache/$1"
|
||||
tar czfv "cache-upload/cache/$1/$tar.tar.gz" node_modules source yarn-cache
|
||||
mkdir -p "cache-upload/cache/$1"
|
||||
tar czfv "cache-upload/cache/$1/$tar.tar.gz" node_modules yarn-cache \
|
||||
lib/vscode/.build \
|
||||
lib/vscode/node_modules
|
||||
}
|
||||
|
||||
main() {
|
||||
cd "$(dirname "$0")/.."
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
# Get the branch for this build.
|
||||
branch=${DRONE_BRANCH:-${DRONE_SOURCE_BRANCH:-${DRONE_TAG:-}}}
|
||||
# Get the branch for this build.
|
||||
branch=${DRONE_BRANCH:-${DRONE_SOURCE_BRANCH:-${DRONE_TAG:-}}}
|
||||
|
||||
# The cache will be named based on the arch, platform, and libc.
|
||||
arch=$DRONE_STAGE_ARCH
|
||||
platform=${PLATFORM:-linux}
|
||||
case $DRONE_STAGE_NAME in
|
||||
*alpine*) libc=musl ;;
|
||||
* ) libc=glibc ;;
|
||||
esac
|
||||
# The cache will be named based on the arch, platform, and libc.
|
||||
arch=$DRONE_STAGE_ARCH
|
||||
platform=${PLATFORM:-linux}
|
||||
case $DRONE_STAGE_NAME in
|
||||
*alpine*) libc=musl ;;
|
||||
* ) libc=glibc ;;
|
||||
esac
|
||||
|
||||
tar="$platform-$arch-$libc"
|
||||
tar="$platform-$arch-$libc"
|
||||
|
||||
# The action is determined by the name of the step.
|
||||
case $DRONE_STEP_NAME in
|
||||
*restore*) restore "$branch" "$DRONE_REPO_BRANCH" ;;
|
||||
*rebuild*|*package*) package "$branch" ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
# The action is determined by the name of the step.
|
||||
case $DRONE_STEP_NAME in
|
||||
*restore*) restore "$branch" "$DRONE_REPO_BRANCH" ;;
|
||||
*rebuild*|*package*) package "$branch" ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
Reference in New Issue
Block a user