国内加速方案,无需vpn,带宽拉满
web.china.template.yml
hooks:
before_code:
- exec:
cmd:
- su discourse -c 'git config --global url."https://ghfast.top/https://github.com/".insteadOf "https://github.com/"'
after_code:
- exec:
cmd:
- |-
cd /var/www/discourse
su discourse -c '
set -o errexit
target="/var/www/discourse/script/assemble_ember_build.rb"
old="https://get.discourse.org/discourse-assets"
new="https://ghfast.top/https://github.com/discourse/discourse-assets/releases/download"
grep -q "$old" "$target"
sed -i "s#${old}#${new}#g" "$target"
grep -q "$new" "$target"
grep -Fq "url = \"#{PRE_BUILD_ROOT}/#{version_string}/#{resolved_ember_env}.tar.gz\"" "$target"
sed -i "s|url = \"#{PRE_BUILD_ROOT}/#{version_string}/#{resolved_ember_env}.tar.gz\"|url = \"#{PRE_BUILD_ROOT}/v#{version_string}/#{resolved_ember_env}.tar.gz\"|g" "$target"
grep -Fq "url = \"#{PRE_BUILD_ROOT}/v#{version_string}/#{resolved_ember_env}.tar.gz\"" "$target"
if grep -q "$old" "$target"; then
echo "ERROR: old prebuilt assets URL still present in $target" >&2
exit 1
fi
if grep -Fq "url = \"#{PRE_BUILD_ROOT}/#{version_string}/#{resolved_ember_env}.tar.gz\"" "$target"; then
echo "ERROR: old prebuilt assets URL expression still present in $target" >&2
exit 1
fi
'
before_web:
- exec:
cmd:
- su discourse -c 'gem sources --add https://mirrors.tuna.tsinghua.edu.cn/rubygems/ --remove https://rubygems.org/'
- su discourse -c 'gem sources --add https://mirrors.tuna.tsinghua.edu.cn/rubygems/ --remove https://api.rubygems.org/'
before_yarn:
- exec:
cmd:
- su discourse -c 'pnpm config set registry https://registry.npmmirror.com --global'
before_bundle_exec:
- exec:
cmd:
- su discourse -c 'bundle config mirror.https://rubygems.org https://mirrors.tuna.tsinghua.edu.cn/rubygems'
- su discourse -c 'bundle config mirror.https://api.rubygems.org https://mirrors.tuna.tsinghua.edu.cn/rubygems'
- cd /var/www/discourse && su discourse -c 'bundle config set frozen false' && su discourse -c 'bundle update diffy' && su discourse -c 'bundle config set frozen true'
web_only.yml
hooks:
after_code:
- exec:
cd: $home/plugins
cmd:
- git clone https://ghfast.top/https://github.com/discourse/docker_manager.git
# - git clone https://ghfast.top/https://github.com/discourse/discourse-graphviz.git
# - git clone https://ghfast.top/https://github.com/discourse/discourse-math.git
#- git clone https://ghfast.top/https://github.com/discourse/discourse-gamification.git
#- git clone https://ghfast.top/https://github.com/discourse/discourse-translator.git
# - git clone https://ghfast.top/https://github.com/discourse/discourse-cakeday.git
- git clone https://ghfast.top/https://github.com/discourse/discourse-saved-searches.git