testing release #69
This file contains 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: Publish documentation | |
# Controls when the workflow will run | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
# Allow this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.11" | |
- name: Upgrade pip | |
run: | | |
# install pip=>20.1 to use "pip cache dir" | |
python3 -m pip install --upgrade pip | |
- name: Get pip cache dir | |
id: pip-cache | |
run: echo "::set-output name=dir::$(pip cache dir)" | |
- name: Cache dependencies | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-doc.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: | | |
python3 -m pip install -r ./requirements-doc.txt | |
pip install -e . | |
- name: Set git credentials | |
run: | | |
git config --global user.name "${{ github.actor }}" | |
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | |
- name: GitHub Tag Name example | |
run: | | |
echo "Tag name from github.ref_name: ${{ github.ref_name }} and from github.event_name ${{ github.event_name }}" | |
- name: Build API reference | |
run: pdocs as_markdown -o docs/ dcm2bids --overwrite | |
- name: Build docs for new release | |
if: github.event_name == 'published' | |
run: | | |
VERSION=$(dcm2bids -v | awk '/dcm2bids/ {print $3}') | |
mike deploy -p $VERSION latest -u | |
- name: Build docs for new release | |
if: github.event_name == 'published' && startsWith(github.ref, 'refs/tags/') | |
run: | | |
VERSION=$(dcm2bids -v | awk '/dcm2bids/ {print $3}') | |
mike deploy -p $VERSION latest -u | |
# - name: Build docs for specific release (already deployed) | |
# if: github.event_name != 'release' && github.ref_name | |
# run: | | |
# VERSION=$(dcm2bids -v | awk '/dcm2bids/ {print $3}') | |
# mike deploy -p $VERSION | |
- name: Deploy dev version | |
if: ${{ github.ref == 'refs/heads/master' }} | |
run: | | |
VERSION=$(dcm2bids -v | awk '/dcm2bids/ {print $3}') | |
mike deploy -p $VERSION dev -u |