blob: be2c57f7d4ed3429ca9794c2661337d7193a975c [file] [log] [blame]
on:
push:
branches:
- stable
name: Deploy Stable Cookbooks
jobs:
make_stable_cookbooks:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- name: Setup pandoc
uses: r-lib/actions/setup-pandoc@v2
- name: Install dependencies
run: |
sudo apt update
sudo apt install libcurl4-openssl-dev \
libidn2-dev \
libkrb5-dev \
libldap-dev \
libnghttp2-dev \
libpsl-dev \
librtmp-dev \
libssh-dev \
libssh2-1-dev \
libssl-dev \
maven \
openjdk-11-jdk \
python3-pip
- 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_stable_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_stable_cookbooks:
name: deploy
runs-on: ubuntu-latest
needs: [make_stable_cookbooks, make_stable_cpp]
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
ref: gh-pages
path: cookbook
- name: Prepare branch
run: |
# Remove everything except dev cookbook
cp -R cookbook/dev .
cd cookbook
git checkout --orphan gh-pages-tmp
git rm -rf .
cp -R ../dev .
- name: Download book artifact
uses: actions/download-artifact@v1.0.0
with:
name: build_book
path: ./cookbook
- name: Download cpp book
uses: actions/download-artifact@v1.0.0
with:
name: cpp_book
path: ./cookbook/cpp
- name: Push changes to gh-pages/asf-site branch
run: |
cd cookbook
rm index_dev.html
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