|
| 1 | +name: Build ESMF Docs |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + |
| 7 | +concurrency: |
| 8 | + group: build-esmf-docs-${{ github.ref_name }} |
| 9 | + cancel-in-progress: true |
| 10 | + |
| 11 | +jobs: |
| 12 | + |
| 13 | + build: |
| 14 | + |
| 15 | + runs-on: ubuntu-latest |
| 16 | + |
| 17 | + steps: |
| 18 | + |
| 19 | + - name: Checkout Dockerfiles |
| 20 | + uses: actions/checkout@v3 |
| 21 | + with: |
| 22 | + repository: esmf-org/esmf-containers |
| 23 | + path: esmf-containers |
| 24 | + ref: main |
| 25 | + |
| 26 | + - name: Build Docker image |
| 27 | + run: | |
| 28 | + cd ${{ github.workspace }}/esmf-containers/build-esmf-docs/esmf |
| 29 | + docker build . --tag esmf/build-esmf-docs --build-arg ESMF_BRANCH="${{ github.ref_name }}" --no-cache |
| 30 | + |
| 31 | + - name: Extract artifacts |
| 32 | + run: | |
| 33 | + mkdir -p ${{ github.workspace }}/artifacts |
| 34 | + CID=$(docker run -dit --name runner esmf/build-esmf-docs) |
| 35 | + docker cp ${CID}:/artifacts/doc-artifacts.zip ${{ github.workspace }}/artifacts |
| 36 | + docker stop ${CID} |
| 37 | + docker rm ${CID} |
| 38 | + |
| 39 | + - name: Upload artifacts |
| 40 | + uses: actions/upload-artifact@v3 |
| 41 | + with: |
| 42 | + name: esmf-docs |
| 43 | + path: ${{ github.workspace }}/artifacts |
| 44 | + |
| 45 | + - name: Checkout esmf-org.github.io |
| 46 | + uses: actions/checkout@v3 |
| 47 | + with: |
| 48 | + repository: esmf-org/esmf-org.github.io |
| 49 | + path: esmf-org.github.io |
| 50 | + token: ${{ secrets.ESMF_WEB_TOKEN }} |
| 51 | + |
| 52 | + - name: Copy docs |
| 53 | + run: | |
| 54 | + cd ${{ github.workspace }}/esmf-org.github.io |
| 55 | + mkdir -p docs/nightly/${{ github.ref_name }}/dev_guide |
| 56 | + cd ${{ github.workspace }}/artifacts |
| 57 | + unzip doc-artifacts.zip |
| 58 | + cd ${{ github.workspace }}/artifacts/artifacts/doc-esmf |
| 59 | + cp -rf ./* ${{ github.workspace }}/esmf-org.github.io/docs/nightly/${{ github.ref_name }}/ |
| 60 | + cd ${{ github.workspace }}/artifacts/artifacts/doc-nuopc |
| 61 | + cp -rf NUOPC_refdoc ${{ github.workspace }}/esmf-org.github.io/docs/nightly/${{ github.ref_name }}/ |
| 62 | + cp -rf NUOPC_refdoc.pdf ${{ github.workspace }}/esmf-org.github.io/docs/nightly/${{ github.ref_name }}/ |
| 63 | + cp -rf NUOPC_howtodoc ${{ github.workspace }}/esmf-org.github.io/docs/nightly/${{ github.ref_name }}/ |
| 64 | + cp -rf NUOPC_howtodoc.pdf ${{ github.workspace }}/esmf-org.github.io/docs/nightly/${{ github.ref_name }}/ |
| 65 | + cd ${{ github.workspace }}/artifacts/artifacts/doc-dev_guide |
| 66 | + cp -rf ./dev_guide/dev_guide/* ${{ github.workspace }}/esmf-org.github.io/docs/nightly/${{ github.ref_name }}/dev_guide/ |
| 67 | + |
| 68 | + - name: Commit and publish docs |
| 69 | + uses: actions-js/push@master |
| 70 | + with: |
| 71 | + repository: esmf-org/esmf-org.github.io |
| 72 | + directory: ${{ github.workspace }}/esmf-org.github.io |
| 73 | + branch: master |
| 74 | + github_token: ${{ secrets.ESMF_WEB_TOKEN }} |
| 75 | + message: 'Publish ESMF Docs' |
0 commit comments