Skip to content

Commit

Permalink
Merge pull request #15 from CCBR/doc-versions
Browse files Browse the repository at this point in the history
docs: use major & minor version for docs subdir
  • Loading branch information
kelly-sovacool authored Oct 10, 2024
2 parents 7ac1ffb + 2c77510 commit f2b3ca7
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 15 deletions.
50 changes: 36 additions & 14 deletions .github/workflows/docs-quartodoc.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# see https://github.com/rstudio/vetiver-python/blob/main/.github/workflows/docs.yml
# adapted from https://github.com/rstudio/vetiver-python/blob/main/.github/workflows/docs.yml
name: "docs"

on:
Expand All @@ -10,8 +10,38 @@ on:
types: [published]

jobs:
version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.VERSION_SHORT }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.11
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install ccbr_actions@git+https://github.com/CCBR/actions
- name: set major & minor version
if: github.ref_type == 'tag' && startswith(github.ref, 'refs/tags/v')
id: version
shell: python {0}
run: |
from ccbr_actions.versions import get_major_minor_version
from ccbr_actions.actions import set_output
if '${{ github.ref_type }}' == 'tag' and '${{ github.ref }}'.startswith('refs/tags/v'):
version = 'dev'
else:
version = get_major_minor_version("${{ github.ref_name }}".lstrip("v"))
set_output('VERSION_SHORT', version)
docs:
runs-on: ubuntu-latest
needs: [version]
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -53,27 +83,19 @@ jobs:
run: |
# use branch name, but replace slashes. E.g. feat/a -> feat-a
echo "RELEASE_NAME=${GITHUB_REF_NAME/\//-}" >> $GITHUB_ENV
- name: publish dev docs
if: github.ref_name == 'main' && github.ref_type == 'branch'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_site
publish_branch: gh-pages
destination_dir: dev
- name: publish stable docs
if: github.ref_type == 'tag' && startswith(github.ref, 'refs/tags/v')
- name: publish docs
if: github.event_name != 'pull_request'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_site
publish_branch: gh-pages
destination_dir: ${{ github.ref_name }}
destination_dir: ${{ needs.version.outputs.version }}
- name: create symlink stable to new version
if: github.ref_type == 'tag' && startswith(github.ref, 'refs/tags/v')
run: |
rm -if latest
ln -s ${{ github.ref_name }} latest
ln -s ${{ needs.version.outputs.version }} latest
ls -la
git add latest
git commit -m 'chore: link latest docs to ${{ github.ref_name }}' && git push || echo 'no changes to commit'
git commit -m 'chore: link latest docs from ${{ needs.version.outputs.version }} (tag ${{ github.ref_name }})' && git push || echo 'no changes to commit'
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Tools development version

- use major & minor version for docs website subdirectories. (#15, @kelly-sovacool)

## Tools 0.1.1

- fix: don't add extra newline to command stdout/stderr for `shell_run()` and `exec_in_context()`. (#10, @kelly-sovacool)
Expand Down
2 changes: 1 addition & 1 deletion src/ccbr_tools/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ test = [
"pytest-cov"
]
docs = [
"quartodoc >= v0.7.6",
"quartodoc >= v0.7.6"
]

[project.scripts]
Expand Down

0 comments on commit f2b3ca7

Please sign in to comment.