doc: update README.md. #44
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
env: | |
CARGO_TERM_COLOR: always | |
MSRV: 1.56.0 | |
on: | |
push: | |
# branches: | |
# - main | |
tags: | |
- v* | |
jobs: | |
check: | |
name: Rust project | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Checkout google/comprehensive-rust code | |
uses: actions/checkout@v4 | |
with: | |
repository: google/comprehensive-rust | |
path: 'comprehensive-rust' | |
- name: Install formatting dependencies | |
run: | | |
sudo apt update | |
sudo apt install gettext yapf3 | |
# - name: Install latest nightly | |
# uses: actions-rs/toolchain@v1 | |
# with: | |
# toolchain: nightly | |
# override: true | |
# components: rustfmt, clippy | |
# - name: Update rustup | |
# run: rustup self update | |
- id: setup | |
name: Setup Toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
components: llvm-tools-preview | |
# - 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.5/mdbook-v0.4.5-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin | |
echo "$(pwd)/bin" >> $GITHUB_PATH | |
- run: mkdir dist | |
- run: git clone https://github.com/rust-lang-cn/rust-by-example-cn.git -b master rust-by-example-cn --depth 1 | |
- run: git clone https://github.com/rust-lang-cn/book-cn.git -b master book --depth 1 | |
- run: git clone https://github.com/rust-lang-cn/std-cn.git -b main std --depth 1 | |
- run: git clone https://github.com/rust-lang-cn/reference-cn.git -b master reference-cn --depth 1 | |
- run: git clone https://github.com/rust-lang-cn/rustdoc-cn.git -b master rustdoc-cn --depth 1 | |
- run: git clone https://github.com/rust-lang-cn/cargo-cn.git -b master cargo --depth 1 | |
- run: git clone https://github.com/rust-lang-cn/edition-guide-cn.git -b master edition-guide --depth 1 | |
- run: git clone https://github.com/rust-lang-cn/nomicon-zh-Hans.git -b main nomicon --depth 1 | |
- run: git clone https://github.com/rust-lang-cn/style-guide-cn.git -b main style-guide-cn --depth 1 | |
- run: git clone https://github.com/zzy/rust-cookbook-zh-cn.git -b master rust-cookbook-cn --depth 1 | |
- run: git clone https://github.com/jaywcjlove/reference.git -b gh-pages quick-reference --depth 1 | |
- run: git clone https://github.com/sunface/rust-course.git -b main rust-course --depth 1 | |
- run: git clone https://github.com/rustlang-cn/rusty-book.git -b main rusty-book --depth 1 | |
- run: git clone https://github.com/rustlang-cn/rust-algos.git -b gh-pages rust-algos --depth 1 | |
- run: cp -rp std/doc dist/std | |
- run: rm -rf book/.git | |
- run: rm -rf rust-by-example-cn/.git | |
- run: rm -rf comprehensive-rust/.git | |
- run: rm -rf quick-reference/.git | |
- run: cp -rp quick-reference dist/quick-reference | |
- run: rm -rf rust-algos/.git | |
- run: cp -rp rust-algos dist/rust-algos | |
- run: rm -rf rust-course/.git | |
- run: rm -rf rusty-book/.git | |
- run: rm -rf style-guide-cn/.git | |
- run: rm -rf reference-cn/.git | |
- name: 📗 book | |
working-directory: book | |
run: | | |
mdbook build | |
rm -rf .git | |
ls -al | |
cp -rp ./book ../dist/book | |
- name: 📗 style-guide-cn | |
working-directory: style-guide-cn | |
run: | | |
mdbook build | |
rm -rf .git | |
ls -al | |
cp -rp ./book ../dist/style-guide-cn | |
- name: 📗 rust-by-example-cn | |
working-directory: rust-by-example-cn | |
run: | | |
mdbook build | |
rm -rf .git | |
ls -al | |
cp -rp ./book ../dist/rust-by-example-cn | |
- name: 📗 rust-course | |
working-directory: rust-course | |
run: | | |
mdbook build | |
rm -rf .git | |
ls -al | |
cp -rp ./book ../dist/rust-course | |
- name: 📗 rusty-book | |
working-directory: rusty-book | |
run: | | |
mdbook build | |
rm -rf .git | |
ls -al | |
cp -rp ./book ../dist/rusty-book | |
- name: 📗 rustdoc-cn | |
working-directory: rustdoc-cn | |
run: | | |
mdbook build | |
rm -rf .git | |
ls -al | |
cp -rp ./book ../dist/rustdoc | |
- name: 📗 reference-cn | |
working-directory: reference-cn | |
run: | | |
mdbook build | |
rm -rf .git | |
ls -al | |
cp -rp ./book ../dist/reference | |
- name: 📗 rust-cookbook-cn | |
working-directory: rust-cookbook-cn | |
run: | | |
mdbook build | |
rm -rf .git | |
cp -rp ./book ../dist/rust-cookbook | |
- name: 📗 cargo | |
working-directory: cargo | |
run: | | |
mdbook build | |
rm -rf .git | |
cp -rp ./book ../dist/cargo | |
- name: 📗 edition-guide | |
working-directory: edition-guide | |
run: | | |
mdbook build | |
rm -rf .git | |
cp -rp ./book ../dist/edition-guide | |
- name: 📗 nomicon | |
working-directory: nomicon | |
run: | | |
mdbook build | |
rm -rf .git | |
cp -rp ./book ../dist/nomicon | |
- name: Install Gettext | |
run: | | |
sudo apt update | |
sudo apt install gettext | |
- name: 📗 comprehensive-rust | |
working-directory: comprehensive-rust | |
env: | |
MDBOOK_BOOK__LANGUAGE: zh-CN | |
run: | | |
cargo clean | |
cargo build | |
cargo install mdbook --locked --version 0.4.36 | |
cargo install mdbook-svgbob --locked --version 0.2.1 | |
cargo install mdbook-i18n-helpers --locked --version 0.3.1 | |
cargo install --path mdbook-exerciser --locked | |
cargo install --path mdbook-course --locked | |
mdbook build -d book/zh-CN | |
rm -rf .git | |
cp -rp ./book/zh-CN/html ../dist/comprehensive-rust | |
- name: Create index.html | |
working-directory: ./dist | |
run: | | |
cat > index.html << EOF | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Rust 相关中文文档</title> | |
<style> | |
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; } | |
h1 { text-align: center; } | |
ul,li { padding: 0; margin: 0; list-style: none;} | |
ul { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 480px; margin: 2.6rem auto;} | |
ul li a { | |
display: flex; | |
align-items: center; | |
cursor: pointer; | |
border-radius: 0.3rem; | |
height: 4rem; | |
box-shadow: 0 0 #0000, 0 0 #0000, 0 2px 3px 0 rgb(0 0 0 / 5%); | |
background-color: #e2e5e6; | |
--bg-opacity: 0.2; | |
background-color: rgb(62 69 72 / var(--bg-opacity)); | |
transition: all 0.3s; | |
padding: 0rem 1.3rem; | |
font-weight: 300; | |
text-decoration: none; | |
} | |
ul li a:hover { | |
--bg-opacity: 0.3; | |
} | |
</style> | |
</head> | |
<body> | |
<header> | |
<a href="https://github.com/jaywcjlove/rust-cn-document-for-docker" target="__blank">Github</a> | |
</header> | |
<h1>Rust 相关中文文档</h1> | |
<ul> | |
<li><a href="book/" target="__blank"> Rust 程序设计语言中文版 </a></li> | |
<li><a href="cargo/" target="__blank"> Cargo 手册中文版 </a></li> | |
<li><a href="edition-guide/" target="__blank"> Rust 版本指南 </a></li> | |
<li><a href="reference/" target="__blank"> Rust 参考手册中文版 </a></li> | |
<li><a href="rustdoc/" target="__blank"> RustDoc 手册中文版 </a></li> | |
<li><a href="rust-cookbook/" target="__blank"> Rust Cookbook 中文版 </a></li> | |
<li><a href="std/std/" target="__blank"> Rust 标准库文档中文版 </a></li> | |
<li><a href="rust-by-example-cn/" target="__blank"> Rust By Example 中文版 </a></li> | |
<li><a href="nomicon/" target="__blank"> Rust 秘典 </a></li> | |
<li><a href="quick-reference/docs/cargo.html" target="__blank"> Cargo 备忘清单(速查表) </a></li> | |
<li><a href="quick-reference/docs/rust.html" target="__blank"> Rust 备忘清单(速查表) </a></li> | |
<li><a href="quick-reference/index.html" target="__blank"> Quick Reference (速查表) </a></li> | |
<li><a href="rust-course/index.html" target="__blank"> Rust 语言圣经 </a></li> | |
<li><a href="rusty-book/index.html" target="__blank"> Rusty Book(锈书) </a></li> | |
<li><a href="style-guide-cn/index.html" target="__blank"> Rust 语言风格指南 </a></li> | |
<li><a href="comprehensive-rust/index.html" target="__blank"> Comprehensive Rust 🦀 </a></li> | |
<li><a href="rust-algos/index.html" target="__blank"> Rust 算法题解 </a></li> | |
</ul> | |
</body> | |
</html> | |
EOF | |
- name: Create README.md | |
working-directory: ./dist | |
run: | | |
cat > README.md << EOF | |
本仓库,将来自 [**@rust-lang-cn**](https://github.com/rust-lang-cn) 中 Rust 相关的中文文档仓库打包到 Docker 中,用于本地部署预览: | |
Github Repo | last commit | home | |
---- | ---- | ---- | |
[Rust 标准库文档中文版](https://github.com/rust-lang-cn/std-cn) | [![GitHub last commit](https://img.shields.io/github/last-commit/rust-lang-cn/std-cn?style=flat&label=last)](https://github.com/rust-lang-cn/std-cn/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/std/std/) | |
[Rust 程序设计语言 中文版](https://github.com/rust-lang-cn/book-cn) | [![GitHub last commit](https://img.shields.io/github/last-commit/rust-lang-cn/book-cn?style=flat&label=last)](https://github.com/rust-lang-cn/book-cn/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/book/) | |
[Rust By Example 中文版](https://github.com/rust-lang-cn/rust-by-example-cn) | [![GitHub last commit](https://img.shields.io/github/last-commit/rust-lang-cn/rust-by-example-cn?style=flat&label=last)](https://github.com/rust-lang-cn/rust-by-example-cn/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/rust-by-example-cn/) | |
[Rust 参考手册中文版](https://github.com/rust-lang-cn/reference-cn) | [![GitHub last commit](https://img.shields.io/github/last-commit/rust-lang-cn/reference-cn?style=flat&label=last)](https://github.com/rust-lang-cn/reference-cn/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/reference/) | |
[RustDoc 手册中文版](https://github.com/rust-lang-cn/rustdoc-cn) | [![GitHub last commit](https://img.shields.io/github/last-commit/rust-lang-cn/rustdoc-cn?style=flat&label=last)](https://github.com/rust-lang-cn/rustdoc-cn/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/rustdoc/) | |
[Rust Cookbook 中文版](https://github.com/rust-lang-cn/rust-cookbook-cn) | [![GitHub last commit](https://img.shields.io/github/last-commit/rust-lang-cn/rust-cookbook-cn?style=flat&label=last)](https://github.com/rust-lang-cn/rust-cookbook-cn/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/rust-cookbook/) | |
[Rust 版本指南](https://github.com/rust-lang-cn/edition-guide-cn) | [![GitHub last commit](https://img.shields.io/github/last-commit/rust-lang-cn/edition-guide-cn?style=flat&label=last)](https://github.com/rust-lang-cn/edition-guide-cn/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/edition-guide/) | |
[Cargo 手册](https://github.com/rust-lang-cn/cargo-cn) | [![GitHub last commit](https://img.shields.io/github/last-commit/rust-lang-cn/cargo-cn?style=flat&label=last)](https://github.com/rust-lang-cn/cargo-cn/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/cargo/) | |
[Rust 秘典](https://github.com/rust-lang-cn/nomicon-zh-Hans) | [![GitHub last commit](https://img.shields.io/github/last-commit/rust-lang-cn/nomicon-zh-Hans?style=flat&label=last)](https://github.com/rust-lang-cn/nomicon-zh-Hans/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/nomicon/) | |
[Cargo 备忘清单(速查表)](https://github.com/jaywcjlove/reference) | [![GitHub last commit](https://img.shields.io/github/last-commit/jaywcjlove/reference?style=flat&label=last)](https://github.com/jaywcjlove/reference/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/quick-reference/docs/cargo.html) | |
[Rust 备忘清单(速查表)](https://github.com/jaywcjlove/reference) | [![GitHub last commit](https://img.shields.io/github/last-commit/jaywcjlove/reference?style=flat&label=last)](https://github.com/jaywcjlove/reference/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/quick-reference/docs/rust.html) | |
[Quick Reference(速查表)](https://github.com/jaywcjlove/reference) | [![GitHub last commit](https://img.shields.io/github/last-commit/jaywcjlove/reference?style=flat&label=last)](https://github.com/jaywcjlove/reference/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/quick-reference/index.html) | |
[Rust 语言圣经](https://github.com/sunface/rust-course) | [![GitHub last commit](https://img.shields.io/github/last-commit/sunface/rust-course?style=flat&label=last)](https://github.com/sunface/rust-course/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/rust-course/index.html) | |
[Rusty Book(锈书)](https://github.com/rustlang-cn/rusty-book) | [![GitHub last commit](https://img.shields.io/github/last-commit/rustlang-cn/rusty-book?style=flat&label=last)](https://github.com/rustlang-cn/rusty-book/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/rusty-book/index.html) | |
[Rust 算法题解](https://github.com/rustlang-cn/rust-algos) | [![GitHub last commit](https://img.shields.io/github/last-commit/rustlang-cn/rust-algos?style=flat&label=last)](https://github.com/rustlang-cn/rust-algos/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/rust-algos/index.html) | |
[Rust 语言风格指南](https://github.com/rust-lang-cn/style-guide-cn) | [![GitHub last commit](https://img.shields.io/github/last-commit/rust-lang-cn/style-guide-cn?style=flat&label=last)](https://github.com/rust-lang-cn/style-guide-cn/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/style-guide-cn/index.html) | |
[Comprehensive Rust 🦀](https://github.com/google/comprehensive-rust) | [![GitHub last commit](https://img.shields.io/github/last-commit/google/comprehensive-rust?style=flat&label=last)](https://github.com/google/comprehensive-rust/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/comprehensive-rust/index.html) | |
EOF | |
- name: Deploy Website | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
user_name: 'github-actions[bot]' | |
user_email: 'github-actions[bot]@users.noreply.github.com' | |
commit_message: ${{ github.event.head_commit.message }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./dist | |
- name: Generate Changelog | |
id: changelog | |
uses: jaywcjlove/changelog-generator@main | |
with: | |
filter-author: (小弟调调™) | |
filter: (^[\s]+?[R|r]elease)|(^[R|r]elease) | |
- name: Create Release | |
uses: ncipollo/release-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
body: | | |
文档: ${{ steps.changelog.outputs.tag }}: https://raw.githack.com/jaywcjlove/rust-cn-document-for-docker/${{ steps.changelog.outputs.gh-pages-short-hash }}/index.html | |
比较变化: ${{ steps.changelog.outputs.compareurl }} | |
Github Repo | last commit | home | |
---- | ---- | ---- | |
[Rust 标准库文档中文版](https://github.com/rust-lang-cn/std-cn) | [![GitHub last commit](https://img.shields.io/github/last-commit/rust-lang-cn/std-cn?style=flat&label=last)](https://github.com/rust-lang-cn/std-cn/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/std/std/) | |
[Rust 程序设计语言 中文版](https://github.com/rust-lang-cn/book-cn) | [![GitHub last commit](https://img.shields.io/github/last-commit/rust-lang-cn/book-cn?style=flat&label=last)](https://github.com/rust-lang-cn/book-cn/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/book/) | |
[Rust By Example 中文版](https://github.com/rust-lang-cn/rust-by-example-cn) | [![GitHub last commit](https://img.shields.io/github/last-commit/rust-lang-cn/rust-by-example-cn?style=flat&label=last)](https://github.com/rust-lang-cn/rust-by-example-cn/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/rust-by-example-cn/) | |
[Rust 参考手册中文版](https://github.com/rust-lang-cn/reference-cn) | [![GitHub last commit](https://img.shields.io/github/last-commit/rust-lang-cn/reference-cn?style=flat&label=last)](https://github.com/rust-lang-cn/reference-cn/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/reference/) | |
[RustDoc 手册中文版](https://github.com/rust-lang-cn/rustdoc-cn) | [![GitHub last commit](https://img.shields.io/github/last-commit/rust-lang-cn/rustdoc-cn?style=flat&label=last)](https://github.com/rust-lang-cn/rustdoc-cn/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/rustdoc/) | |
[Rust Cookbook 中文版](https://github.com/rust-lang-cn/rust-cookbook-cn) | [![GitHub last commit](https://img.shields.io/github/last-commit/rust-lang-cn/rust-cookbook-cn?style=flat&label=last)](https://github.com/rust-lang-cn/rust-cookbook-cn/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/rust-cookbook/) | |
[Rust 版本指南](https://github.com/rust-lang-cn/edition-guide-cn) | [![GitHub last commit](https://img.shields.io/github/last-commit/rust-lang-cn/edition-guide-cn?style=flat&label=last)](https://github.com/rust-lang-cn/edition-guide-cn/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/edition-guide/) | |
[Cargo 手册](https://github.com/rust-lang-cn/cargo-cn) | [![GitHub last commit](https://img.shields.io/github/last-commit/rust-lang-cn/cargo-cn?style=flat&label=last)](https://github.com/rust-lang-cn/cargo-cn/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/cargo/) | |
[Rust 秘典](https://github.com/rust-lang-cn/nomicon-zh-Hans) | [![GitHub last commit](https://img.shields.io/github/last-commit/rust-lang-cn/nomicon-zh-Hans?style=flat&label=last)](https://github.com/rust-lang-cn/nomicon-zh-Hans/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/nomicon/) | |
[Cargo 备忘清单(速查表)](https://github.com/jaywcjlove/reference) | [![GitHub last commit](https://img.shields.io/github/last-commit/jaywcjlove/reference?style=flat&label=last)](https://github.com/jaywcjlove/reference/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/quick-reference/docs/cargo.html) | |
[Rust 备忘清单(速查表)](https://github.com/jaywcjlove/reference) | [![GitHub last commit](https://img.shields.io/github/last-commit/jaywcjlove/reference?style=flat&label=last)](https://github.com/jaywcjlove/reference/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/quick-reference/docs/rust.html) | |
[Quick Reference(速查表)](https://github.com/jaywcjlove/reference) | [![GitHub last commit](https://img.shields.io/github/last-commit/jaywcjlove/reference?style=flat&label=last)](https://github.com/jaywcjlove/reference/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/quick-reference/index.html) | |
[Rust 语言圣经](https://github.com/sunface/rust-course) | [![GitHub last commit](https://img.shields.io/github/last-commit/sunface/rust-course?style=flat&label=last)](https://github.com/sunface/rust-course/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/rust-course/index.html) | |
[Rusty Book(锈书)](https://github.com/rustlang-cn/rusty-book) | [![GitHub last commit](https://img.shields.io/github/last-commit/rustlang-cn/rusty-book?style=flat&label=last)](https://github.com/rustlang-cn/rusty-book/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/rusty-book/index.html) | |
[Rust 算法题解](https://github.com/rustlang-cn/rust-algos) | [![GitHub last commit](https://img.shields.io/github/last-commit/rustlang-cn/rust-algos?style=flat&label=last)](https://github.com/rustlang-cn/rust-algos/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/rust-algos/index.html) | |
[Rust 语言风格指南](https://github.com/rust-lang-cn/style-guide-cn) | [![GitHub last commit](https://img.shields.io/github/last-commit/rust-lang-cn/style-guide-cn?style=flat&label=last)](https://github.com/rust-lang-cn/style-guide-cn/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/style-guide-cn/index.html) | |
[Comprehensive Rust 🦀](https://github.com/google/comprehensive-rust) | [![GitHub last commit](https://img.shields.io/github/last-commit/google/comprehensive-rust?style=flat&label=last)](https://github.com/google/comprehensive-rust/commits) | [#home](https://jaywcjlove.github.io/rust-cn-document-for-docker/comprehensive-rust/index.html) | |
${{ steps.changelog.outputs.changelog }} | |
- name: Modify README.md | |
uses: jaywcjlove/github-action-modify-file-content@main | |
with: | |
branch: main | |
path: README.md | |
body: "{{date:YYYY-MM-DD HH:mm:ss}}" | |
# Create Docker Image | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push image:latest | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ secrets.DOCKER_USER }}/rust-cn-document-for-docker:latest | |
- name: Print tag version | |
run: | | |
echo "Tag version: ${GITHUB_REF#refs/tags/v}" | |
- name: Set version variable | |
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV | |
- name: Build and push image:tags | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
# tags: ${{ secrets.DOCKER_USER }}/rust-cn-document-for-docker:${{ github.ref }} | |
tags: ${{ secrets.DOCKER_USER }}/rust-cn-document-for-docker:${{ env.VERSION }} | |
# Create Docker Image in Github | |
# - name: Login to the GitHub Container Registry | |
# uses: docker/login-action@v2 | |
# with: | |
# registry: ghcr.io | |
# username: ${{ github.actor }} | |
# password: ${{ secrets.GITHUB_TOKEN }} | |
# - name: Build and push image:latest | |
# uses: docker/build-push-action@v3 | |
# with: | |
# push: true | |
# context: . | |
# platforms: linux/amd64,linux/arm64 | |
# tags: ghcr.io/jaywcjlove/rust-cn-document-for-docker:latest | |
# - name: Build and push image:tags | |
# uses: docker/build-push-action@v3 | |
# if: steps.create_tag.outputs.successful | |
# with: | |
# push: true | |
# context: . | |
# platforms: linux/amd64,linux/arm64 | |
# tags: ghcr.io/jaywcjlove/rust-cn-document-for-docker:${{steps.changelog.outputs.version}} | |
# # Create Docker Image | |
# - name: Docker login | |
# run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }} | |
# - name: Build rust-cn-document-for-docker image | |
# run: docker image build -t rust-cn-document-for-docker . | |
# - name: Tags & Push image | |
# run: | | |
# # Strip git ref prefix from version | |
# VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# # Strip "v" prefix from tag name | |
# [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
# echo "outputs.tag - $VERSION" | |
# docker tag rust-cn-document-for-docker ${{ secrets.DOCKER_USER }}/rust-cn-document-for-docker:$VERSION | |
# docker tag rust-cn-document-for-docker ${{ secrets.DOCKER_USER }}/rust-cn-document-for-docker:latest | |
# docker push ${{ secrets.DOCKER_USER }}/rust-cn-document-for-docker:$VERSION | |
# docker push ${{ secrets.DOCKER_USER }}/rust-cn-document-for-docker:latest | |
# # Create Docker Image in Github | |
# - name: Login to GitHub registry | |
# run: echo ${{ github.token }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
# - name: Build docker image | |
# run: docker build -t ghcr.io/jaywcjlove/rust-cn-document-for-docker:latest . | |
# - name: Publish to GitHub registry | |
# run: docker push ghcr.io/jaywcjlove/rust-cn-document-for-docker:latest | |
# - name: Tag docker image (beta) and publish to GitHub registry | |
# run: | | |
# # Strip git ref prefix from version | |
# VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# # Strip "v" prefix from tag name | |
# [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
# echo "version: v$VERSION" | |
# docker tag ghcr.io/jaywcjlove/rust-cn-document-for-docker:latest ghcr.io/jaywcjlove/rust-cn-document-for-docker:$VERSION | |
# docker push ghcr.io/jaywcjlove/rust-cn-document-for-docker:$VERSION |