Skip to content

Build for comprehensive-rust(en&zh) #570

Build for comprehensive-rust(en&zh)

Build for comprehensive-rust(en&zh) #570

name: Build for comprehensive-rust(en&zh)
on:
# push:
# branches:
# - master
schedule:
- cron: '0 6 * * *'
workflow_dispatch:
repository_dispatch:
jobs:
build_and_deploy:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v2
- name: Install mdbook
uses: actions-rs/install@v0.1
with:
crate: mdbook
version: latest
use-tool-cache: true
- name: Clone comprehensive-rust
run: |
git clone https://x-access-token:${GITHUB_TOKEN}@github.com/google/comprehensive-rust comprehensive-rust
cd comprehensive-rust
cargo install mdbook-svgbob
cargo install mdbook-i18n-helpers
cargo install --path mdbook-exerciser
cargo install --path mdbook-course
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: init oss config
uses: yizhoumo/setup-ossutil@v1
with:
ossutil-version: '1.7.3'
endpoint: ${{secrets.OSS_ENDPOINT}}
access-key-id: ${{secrets.OSS_ID}}
access-key-secret: ${{secrets.OSS_SECRET}}
sts-token: ""
- name: Build comprehensive-rust
run: |
# Build comprehensive-rust
mkdir -pv archive/{en,zh}
cd comprehensive-rust
# build english version.
mdbook build
cp -ar book/* ../archive/en/
# build chinese version.
export MDBOOK_BOOK__LANGUAGE=zh-CN
rm -rf book/
mdbook build
cp -ar book/html/* ../archive/zh/
# Upload to oss
ls -alhtr && cd .. && \
ossutil sync archive/ oss://${{ secrets.OSS_BUCKET }}/comprehensive-rust/ -f --delete
- name: Sending Build Status
if: always()
env:
DINGTALK_ACCESS_TOKEN: ${{ secrets.DINGTALK_ACCESS_TOKEN }}
DINGTALK_SECRET: ${{ secrets.DINGTALK_SECRET }}
JOB_STATE: ${{ job.status }}
RUNNER_OS: ${{ runner.os }}
GITHUB_REF: ${{ github.ref }}
GITHUB_RUN_ID: ${{ github.run_id }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_WORKFLOW: ${{ env.GITHUB_WORKFLOW }}
run: python3 notify.py