| on: |
| push: |
| branches: |
| - main |
| |
| name: Deploy Cookbooks |
| |
| jobs: |
| make_cookbooks: |
| name: build |
| runs-on: ubuntu-latest |
| steps: |
| - uses: actions/checkout@v3 |
| - name: Setup R |
| uses: r-lib/actions/setup-r@v2 |
| - name: Setup pandoc |
| uses: r-lib/actions/setup-pandoc@v2 |
| - name: Install dependencies |
| run: | |
| sudo apt update |
| sudo apt install libcurl4-openssl-dev libssl-dev python3-pip openjdk-11-jdk maven |
| - name: Run tests |
| run: make test |
| - name: Build and render books |
| run: make all |
| - name: Copy .asf.yaml |
| run: cp .asf.yaml build/.asf.yaml |
| - name: Upload book artifact |
| uses: actions/upload-artifact@v3 |
| with: |
| name: build_book |
| path: build/ |
| |
| make_cpp: |
| name: build c++ |
| runs-on: ubuntu-latest |
| defaults: |
| run: |
| shell: bash -l {0} |
| steps: |
| - uses: actions/checkout@v3 |
| - name: Cache conda |
| uses: actions/cache@v2 |
| env: |
| # Increase this value to reset cache if cpp/environment.yml has not changed |
| CACHE_NUMBER: 0 |
| with: |
| path: ~/conda_pkgs_dir |
| key: |
| ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('cpp/environment.yml') }} |
| - name: Setup environment |
| uses: conda-incubator/setup-miniconda@v2 |
| with: |
| auto-update-conda: true |
| python-version: 3.9 |
| activate-environment: cookbook-cpp |
| environment-file: cpp/environment.yml |
| auto-activate-base: false |
| - name: Test |
| run: |
| echo ${CONDA_PREFIX} |
| - name: Build cookbook |
| run: |
| make cpp |
| - name: Upload cpp book |
| uses: actions/upload-artifact@v3 |
| with: |
| name: cpp_book |
| path: build/cpp |
| |
| deploy_cookbooks: |
| name: deploy |
| runs-on: ubuntu-latest |
| needs: [make_cookbooks, make_cpp] |
| steps: |
| - name: Checkout repo |
| uses: actions/checkout@v3 |
| with: |
| ref: gh-pages |
| - name: Prepare branch |
| run: | |
| git checkout --orphan gh-pages-tmp |
| git rm -rf . |
| - name: Download book artifact |
| uses: actions/download-artifact@v1.0.0 |
| with: |
| name: build_book |
| path: . |
| - name: Download cpp book |
| uses: actions/download-artifact@v1.0.0 |
| with: |
| name: cpp_book |
| path: ./cpp |
| - name: Push changes to gh-pages/asf-site branch |
| run: | |
| git config --global user.name 'GitHub Actions' |
| git config --global user.email 'actions@github.com' |
| git add --all |
| git commit -m 'publish built book' |
| git push -f origin gh-pages-tmp:gh-pages |
| git push -f origin gh-pages-tmp:asf-site |