Merge pull request #7 from JD2112/devel #13
  
    
      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-docs | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - devel | |
| permissions: | |
| contents: write | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 # Fetch all branches and tags | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.x' | |
| - name: Generate cache key | |
| run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV | |
| - name: Extract version from nextflow.config | |
| run: | | |
| version=$(grep "version" nextflow.config | tail -1 | sed -e s'/[^=]*= //' | cut -d "'" -f 2) | |
| [[ $version == *"devel"* ]] && pipeline_version="devel" || pipeline_version=$version | |
| echo "pipeline_version=$pipeline_version" >> $GITHUB_ENV | |
| - name: Configure git user for deploy | |
| run: | | |
| git config --global user.name "${{ github.actor }}" | |
| git config --global user.email "${{ github.actor }}@users.noreply.github.com" | |
| - name: Inject current year into mkdocs.yml | |
| run: python update_year.py | |
| - name: Cache mkdocs builds | |
| uses: actions/cache@v3 | |
| with: | |
| path: .cache | |
| key: mkdocs-material-${{ env.cache_id }} | |
| restore-keys: | | |
| mkdocs-material- | |
| - name: Install dependencies | |
| run: | | |
| pip install mkdocs-material pymdown-extensions pillow cairosvg mike | |
| - name: Build and deploy docs | |
| run: | | |
| if [[ "${{ env.pipeline_version }}" == "devel" ]]; then | |
| mike deploy --push devel | |
| else | |
| mike deploy --push --update-aliases ${{ env.pipeline_version }} latest | |
| fi | |
| - name: Set latest as default version | |
| if: ${{ env.pipeline_version != 'devel' }} | |
| run: mike set-default --push latest |