Build for rust-on-esp-book. #194
This file contains hidden or 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: Build for rust-on-esp-book. | |
| on: | |
| # push: | |
| # branches: | |
| # - master | |
| schedule: | |
| - cron: '0 6 * * *' | |
| workflow_dispatch: | |
| repository_dispatch: | |
| env: | |
| MDBOOK_VERSION: "0.4.28" | |
| jobs: | |
| build_and_deploy: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout the repository | |
| uses: actions/checkout@v2 | |
| - name: Download mdBook ${{ env.MDBOOK_VERSION }} | |
| run: | | |
| mkdir -p /tmp/mdbook | |
| curl -Lo- https://github.com/rust-lang/mdBook/releases/download/v${{ env.MDBOOK_VERSION }}/mdbook-v${{ env.MDBOOK_VERSION }}-x86_64-unknown-linux-gnu.tar.gz | tar -C /tmp/mdbook -xzv | |
| - name: Clone rust-on-esp book | |
| run: git clone https://x-access-token:${GITHUB_TOKEN}@github.com/esp-rs/book.git rust-on-esp-en | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Clone rust-on-esp book | |
| run: git clone https://x-access-token:${GITHUB_TOKEN}@github.com/Narukara/rust-on-esp-book-zh-cn.git rust-on-esp-zh | |
| 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 rust-on-esp book | |
| run: | | |
| # Build rust-on-esp book | |
| mkdir -pv rust-on-esp-archive/{en,zh} | |
| cd rust-on-esp-zh/ && \ | |
| /tmp/mdbook/mdbook build && \ | |
| cp -ar book/* ../rust-on-esp-archive/zh/ | |
| cd ../rust-on-esp-en/ && \ | |
| /tmp/mdbook/mdbook build && \ | |
| cp -ar book/* ../rust-on-esp-archive/en/ | |
| # Upload to oss | |
| ls -alhtr && \ | |
| cd ../ && \ | |
| ossutil sync rust-on-esp-archive/ oss://${{ secrets.OSS_BUCKET }}/book-rs/rust-on-esp/ -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 |