| 
 | 1 | +# CI jobs to be run upon the code lands to the main branch or GitHub Action test branches.  | 
 | 2 | + | 
1 | 3 | name: ci-post-land  | 
2 | 4 | 
 
  | 
3 | 5 | on:  | 
4 |  | -  create:  | 
5 |  | -    branches: [main, release-*]  | 
6 | 6 |   push:  | 
7 |  | -    branches: [main, release-*, gha-test-*]  | 
8 |  | - | 
9 |  | -defaults:  | 
10 |  | -  run:  | 
11 |  | -    shell: bash  | 
12 |  | - | 
13 |  | -env:  | 
14 |  | -  max_threads: 16  | 
15 |  | -  pre_command: cd /opt/git/diem/  | 
 | 7 | +    branches: [main, gha-test-*]  | 
16 | 8 | 
 
  | 
17 | 9 | jobs:  | 
18 |  | -  prepare:  | 
 | 10 | +  generate-documentation:  | 
 | 11 | +    name: Generate the Move Book using mdBook  | 
19 | 12 |     runs-on: ubuntu-20.04  | 
20 |  | -    outputs:  | 
21 |  | -      changes-target-branch: ${{ steps.changes.outputs.changes-target-branch }}  | 
22 |  | -      changes-base-git-rev: ${{ steps.changes.outputs.changes-base-git-rev }}  | 
23 |  | -      changes-base-githash: ${{ steps.changes.outputs.changes-base-githash }}  | 
24 |  | -      changes-pull-request-number: ${{ steps.changes.outputs.changes-pull-request-number }}  | 
25 |  | -      rust-changes: ${{ steps.rust-changes.outputs.changes-found }}  | 
26 |  | -      base-image-changes: ${{ steps.base-image-changes.outputs.changes-found }}  | 
 | 13 | +    concurrency:  | 
 | 14 | +      group: ${{ github.workflow }}-${{ github.ref }}  | 
27 | 15 |     steps:  | 
28 |  | - | 
29 |  | -        with:  | 
30 |  | -          # This ensures that the tip of the PR is checked out instead of the merge between the base ref and the tip  | 
31 |  | -          # On `push` this value will be empty and will "do-the-right-thing"  | 
32 |  | -          ref: ${{ github.event.pull_request.head.sha }}  | 
33 |  | -          fetch-depth: 0 #get all the history!!!  | 
34 |  | -      - name: Git Hooks and Checks  | 
35 |  | -        run: ./scripts/git-checks.sh  | 
36 |  | -      - id: changes  | 
37 |  | -        name: determine changes  | 
38 |  | -        uses: diem/actions/changes@faadd16607b77dfa2231a8f366883e01717b3225  | 
39 |  | -        with:  | 
40 |  | -          workflow-file: ci-post-land.yml  | 
41 |  | -          github-token: ${{secrets.GITHUB_TOKEN}}  | 
42 |  | -      - id: rust-changes  | 
43 |  | -        name: find rust/cargo changes.  | 
44 |  | -        uses: diem/actions/matches@faadd16607b77dfa2231a8f366883e01717b3225  | 
45 |  | -        with:  | 
46 |  | -          pattern: '^documentation\|^docker\|^scripts\|^developers.diem.com'  | 
47 |  | -          invert: "true"  | 
48 |  | -      - id: base-image-changes  | 
49 |  | -        name: find dev-setup.sh/base docker image changes  | 
50 |  | -        uses: diem/actions/matches@faadd16607b77dfa2231a8f366883e01717b3225  | 
51 |  | -        with:  | 
52 |  | -          pattern: '.github/workflows/ci-post-land.yml\|.github/actions/dockerhub_login/action.yml\|docker/ci/github/Dockerfile\|scripts/dev_setup.sh\|rust-toolchain'  | 
 | 16 | +      - uses: actions/checkout@v2  | 
53 | 17 | 
 
  | 
54 |  | -  build_ci_base_docker_image:  | 
55 |  | -    needs: prepare  | 
56 |  | -    runs-on: ubuntu-20.04-xl  | 
57 |  | -    if: ${{ needs.prepare.outputs.base-image-changes == 'true' || github.event_name == 'create' }}  | 
58 |  | -    env:  | 
59 |  | -      REGISTRY: ghcr.io  | 
60 |  | -      IMAGE_NAME: ${{ github.repository }}_build_environment  | 
61 |  | -      IMAGE_TAG: ${{ needs.prepare.outputs.changes-target-branch }}  | 
62 |  | -    steps:  | 
63 |  | - | 
64 |  | -        with:  | 
65 |  | -          # This ensures that the tip of the PR is checked out instead of the merge between the base ref and the tip  | 
66 |  | -          # On `push` this value will be empty and will "do-the-right-thing"  | 
67 |  | -          ref: ${{ github.event.pull_request.head.sha }}  | 
68 |  | -          fetch-depth: 0 #get all the history!!!  | 
69 |  | -      - name: Log in to the Container registry  | 
70 |  | -        uses: docker/login-action@v1  | 
 | 18 | +      - name: Setup mdBook  | 
 | 19 | +        uses: peaceiris/actions-mdbook@v1  | 
71 | 20 |         with:  | 
72 |  | -          registry: ${{ env.REGISTRY }}  | 
73 |  | -          username: ${{ github.actor }}  | 
74 |  | -          password: ${{ secrets.GITHUB_TOKEN }}  | 
75 |  | -      - name: build image  | 
76 |  | -        run: docker build -f docker/ci/github/Dockerfile -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} .  | 
77 |  | -      - name: Push to ghcr  | 
78 |  | -        run: |  | 
79 |  | -          docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}  | 
 | 21 | +          mdbook-version: '0.4.10'  | 
 | 22 | +          # mdbook-version: 'latest'  | 
80 | 23 | 
 
  | 
81 |  | -  # rustdoc:  | 
82 |  | -  #   needs: prepare  | 
83 |  | -  #   if: ${{ needs.prepare.outputs.changes-target-branch == 'main' && needs.prepare.outputs.rust-changes == 'true'}}  | 
84 |  | -  #   runs-on: ubuntu-20.04  | 
85 |  | -  #   container:  | 
86 |  | -  #     image: ghcr.io/diem/diem_build_environment:${{ needs.prepare.outputs.changes-target-branch }}  | 
87 |  | -  #     volumes:  | 
88 |  | -  #       - "${{github.workspace}}:/opt/git/diem"  | 
89 |  | -  #   steps:  | 
90 |  | -  #     - name: Checkout repository  | 
91 |  | - | 
92 |  | -  #     - uses: ./.github/actions/build-setup  | 
93 |  | -  #     - uses: actions/[email protected]  | 
94 |  | -  #       with:  | 
95 |  | -  #         path: "/opt/cargo/git\n/opt/cargo/registry\n/opt/cargo/.package-cache"  | 
96 |  | -  #         key: crates-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}  | 
97 |  | -  #         restore-keys: "crates-${{ runner.os }}"  | 
98 |  | -  #     - name: Build Documentation  | 
99 |  | -  #       # Build the rust crate docs  | 
100 |  | -  #       # Use `RUSTC_BOOTSTRAP` in order to use the `--enable-index-page` flag of rustdoc  | 
101 |  | -  #       # This is needed in order to generate a landing page `index.html` for workspaces  | 
102 |  | -  #       run: cargo doc --no-deps --workspace --lib  | 
103 |  | -  #       env:  | 
104 |  | -  #         RUSTC_BOOTSTRAP: 1  | 
105 |  | -  #         RUSTDOCFLAGS: "-Z unstable-options --enable-index-page"  | 
106 |  | -  #         CARGO_INCREMENTAL: 0  | 
107 |  | -  #         RUSTFLAGS: -D warnings  | 
108 |  | -  #     - name: copy API specification doc into target/doc/diem_api  | 
109 |  | -  #       run : cp api/doc/openapi.yaml target/doc/diem_api/openapi.yaml && cp api/doc/spec.html target/doc/diem_api/spec.html  | 
110 |  | -  #     - name: Deploy Docs  | 
111 |  | -  #       uses: peaceiris/[email protected]  | 
112 |  | -  #       with:  | 
113 |  | -  #         github_token: ${{ secrets.GITHUB_TOKEN }}  | 
114 |  | -  #         publish_branch: gh-pages  | 
115 |  | -  #         publish_dir: ./target/doc  | 
116 |  | -  #         force_orphan: true  | 
 | 24 | +      - run: mdbook build language/documentation/book  | 
 | 25 | + | 
 | 26 | +      - name: Deploy  | 
 | 27 | +        uses: peaceiris/actions-gh-pages@v3  | 
 | 28 | +        with:  | 
 | 29 | +          github_token: ${{ secrets.GITHUB_TOKEN }}  | 
 | 30 | +          publish_dir: ./language/documentation/book/book  | 
0 commit comments