Build for Tlborm #1395
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 Tlborm | |
| 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/[email protected] | |
| with: | |
| crate: mdbook | |
| version: latest | |
| use-tool-cache: true | |
| - name: Clone tlborm book | |
| run: git clone https://x-access-token:${GITHUB_TOKEN}@github.com/Veykril/tlborm.git tlborm-en | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Clone tlborm book | |
| run: git clone https://x-access-token:${GITHUB_TOKEN}@github.com/zjp-CN/tlborm.git tlborm-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 tlborm book | |
| run: | | |
| # ----- prepare tools ----- | |
| mkdir ~/tools | |
| gh release download -R Michael-F-Bryan/mdbook-linkcheck -p mdbook-linkcheck.x86_64-unknown-linux-gnu.zip | |
| unzip mdbook-linkcheck.x86_64-unknown-linux-gnu.zip -d ~/tools | |
| chmod +x ~/tools/mdbook-linkcheck | |
| gh release download -R zjp-CN/mdbook-theme -p mdbook-theme_linux.tar.gz | |
| tar -xzf mdbook-theme_linux.tar.gz -C ~/tools | |
| echo ~/tools >> $GITHUB_PATH | |
| # ----- end prepare tools ----- | |
| # Build tlborm book | |
| mkdir -pv tlborm-archive/{en,zh} | |
| cd tlborm-en && \ | |
| mdbook build && \ | |
| cp -ar book/* ../tlborm-archive/en/ | |
| cd ../tlborm-zh && \ | |
| mdbook build && \ | |
| cp -ar book/* ../tlborm-archive/zh/ | |
| # Upload to oss | |
| ls -alhtr && \ | |
| cd .. && \ | |
| ossutil sync tlborm-archive/ oss://${{ secrets.OSS_BUCKET }}/book-rs/tlborm/ -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 |