diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..a0b91eb --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,47 @@ +name: CI +on: [push, pull_request] + +jobs: + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@main + - name: Update rustup + run: rustup self update + - name: Install Rust + run: | + rustup set profile minimal + rustup toolchain install nightly -c rust-docs + rustup default nightly + - name: Install mdbook + run: | + mkdir bin + curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.15/mdbook-v0.4.15-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin + echo "$(pwd)/bin" >> ${GITHUB_PATH} + echo "$(pwd)/bin" >> $GITHUB_PATH + - name: Report versions + run: | + rustup --version + rustc -Vv + mdbook --version + - name: Run tests + run: mdbook test + - name: Build HTML + run: mdbook build + + deploy: + if: ${{ github.ref == 'refs/heads/main' }} + name: Deploy + runs-on: ubuntu-latest + needs: test + steps: + - name: Deploy to server + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.SSH_HOST }} + username: ${{ secrets.SSH_USERNAME }} + key: ${{ secrets.SSH_KEY }} + port: ${{ secrets.SSH_PORT }} + script: | + ./tools/rust-deploy/update-cn.sh >/dev/null 2>&1 diff --git a/README.md b/README.md index 3da1c58..d20f038 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,26 @@ # Rust 语言风格指南 -这是 《Rust 语言风格指南》中文版,翻译自英文原版[《The Rust Style Guide》][style-guide]。 +![Build Status](https://github.com/rust-lang-cn/style-guide-cn/workflows/CI/badge.svg) +[![LICENSE-MIT](https://img.shields.io/badge/license-MIT-green)](https://raw.githubusercontent.com/rust-lang-cn/style-guide-cn/master/LICENSE-MIT) +[![LICENSE-APACHE](https://img.shields.io/badge/license-Apache%202-blue)](https://raw.githubusercontent.com/rust-lang-cn/style-guide-cn/master/LICENSE-APACHE) +[![GitHub last commit](https://img.shields.io/github/last-commit/rust-lang-cn/style-guide-cn?color=gold)](https://github.com/rust-lang-cn/style-guide-cn/commits/master) +[![GitHub contributors](https://img.shields.io/github/contributors/rust-lang-cn/style-guide-cn?color=pink)](https://github.com/rust-lang-cn/style-guide-cn/graphs/contributors) +![Locatized 100%](https://img.shields.io/badge/localized-100%25-purple) +[![rustwiki.org](https://img.shields.io/website?up_message=rustwiki.org&url=https%3A%2F%2Frustwiki.org)](https://rustwiki.org) -[style-guide]: https://doc.rust-lang.org/beta/style-guide/index.html +> The Chinese Translation of [The Rust Style Guide][style-guide-en] +> +> - 首次于 2023-07-31 翻译完全部内容,欢迎纠正——最后更新时间 2023-07-31。 +> - 期待更多朋友加入 [Rust 中文翻译项目组](https://github.com/rust-lang-cn),协助我们,一起更新完善中文版,感激不尽! + +这是《Rust 语言风格指南》中文版,翻译自 [Rust 源码中的《style-guide Book》][style-guide-src]。 + +在线版可在本组织官网上阅读,包括[全球站点][style-guide-cn]或[国内站点][style-guide-cn-zh](**支持同一页面中英双语切换**),或者在 Rust 官网上[阅读英文版][style-guide-en]。 + +[style-guide-src]: https://github.com/rust-lang/rust/tree/master/src/doc/style-guide +[style-guide-cn]: https://rustwiki.org/zh-CN/style-guide/ +[style-guide-cn-zh]: https://www.rustwiki.org.cn/zh-CN/style-guide/ +[style-guide-en]: https://doc.rust-lang.org/style-guide/ ## 构建 @@ -12,7 +30,7 @@ ```sh $ git clone https://github.com/rust-lang-cn/style-guide-cn.git -$ cd rustc-cn +$ cd style-guide-cn $ mdbook serve ``` @@ -28,4 +46,11 @@ $ mdbook build ## 许可协议 -本项目遵循 MIT 或 Apache 2.0 协议。 +《Rust 语言风格指南》(中文版与英文版 *The Rust Style Guide* 均) 使用以下两种协议的任一种进行授权: + +- Apache 2.0 授权协议,([LICENSE-APACHE](LICENSE-APACHE) 或 http://www.apache.org/licenses/LICENSE-2.0) +- MIT 授权协议 ([LICENSE-MIT](LICENSE-MIT) 或 http://opensource.org/licenses/MIT) + +可以根据自己选择来定。 + +除非您有另外说明,否则您在本仓库提交的任何贡献均按上述方式进行双重许可授权,就如 Apache 2.0 协议所规定那样,而无需附加任何其他条款或条件。