Skip to content

Commit 8786382

Browse files
Bobbins228openshift-merge-bot[bot]
authored andcommittedOct 17, 2024
ci: add publish documentation workflow update release workflow
1 parent 5606f84 commit 8786382

File tree

3 files changed

+50
-25
lines changed

3 files changed

+50
-25
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Publish Documentation
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
codeflare_sdk_release_version:
7+
type: string
8+
required: true
9+
description: 'Version number (for example: 0.1.0)'
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
docs:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Install Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: 3.9
23+
- name: Install Sphinx
24+
run: |
25+
sudo apt-get update
26+
sudo apt-get install python3-sphinx
27+
- name: Install Poetry
28+
uses: abatilo/actions-poetry@v2
29+
with:
30+
poetry-version: 1.8.3
31+
- name: Create new documentation
32+
run: |
33+
python3 -m venv .venv
34+
source .venv/bin/activate
35+
poetry install --with docs
36+
sed -i 's/release = "v[0-9]\+\.[0-9]\+\.[0-9]\+"/release = "${{ github.event.inputs.codeflare_sdk_release_version }}"/' docs/sphinx/conf.py
37+
sphinx-apidoc -o docs/sphinx src/codeflare_sdk "**/*test_*" --force # Generate docs but ignore test files
38+
make html -C docs/sphinx
39+
- name: Deploy to GitHub Pages
40+
uses: peaceiris/actions-gh-pages@v3
41+
with:
42+
publish_branch: gh-pages
43+
github_token: ${{ secrets.GITHUB_TOKEN }}
44+
publish_dir: docs/sphinx/_build/html
45+
force_orphan: true

‎.github/workflows/release.yaml

+4-25
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ jobs:
3333
permissions:
3434
contents: write
3535
id-token: write # This permission is required for trusted publishing
36-
env:
37-
PR_BRANCH_NAME: adjustments-release-${{ github.event.inputs.release-version }}
3836
steps:
3937
- name: Checkout the repository
4038
uses: actions/checkout@v4
@@ -52,35 +50,16 @@ jobs:
5250
run: poetry install --with docs
5351
- name: Create new documentation
5452
run: |
55-
sphinx-apidoc -o docs/sphinx src/codeflare_sdk "**/*test_*" --force
56-
make clean -C docs/sphinx
57-
make html -C docs/sphinx
53+
gh workflow run publish-documentation.yaml \
54+
--repo ${{ github.event.inputs.codeflare-repository-organization }}/codeflare-sdk \
55+
--ref ${{ github.ref }} \
56+
--field codeflare_sdk_release_version=${{ github.event.inputs.release-version }}
5857
- name: Copy demo notebooks into SDK package
5958
run: cp -r demo-notebooks src/codeflare_sdk/demo-notebooks
6059
- name: Run poetry build
6160
run: poetry build
62-
- name: Commit changes in docs
63-
uses: stefanzweifel/git-auto-commit-action@v4
64-
with:
65-
file_pattern: 'docs'
66-
commit_message: "Changes in docs for release: v${{ github.event.inputs.release-version }}"
67-
create_branch: true
68-
branch: ${{ env.PR_BRANCH_NAME }}
69-
- name: Create a PR with code changes
70-
run: |
71-
if git branch -a | grep "${{ env.PR_BRANCH_NAME }}"; then
72-
GIT_BRANCH=${GITHUB_REF#refs/heads/}
73-
gh pr create --base "$GIT_BRANCH" --fill --head "${{ env.PR_BRANCH_NAME }}" --label "lgtm" --label "approved"
74-
fi
7561
env:
7662
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
77-
- name: Wait until PR with code changes is merged
78-
run: |
79-
if git branch -a | grep "${{ env.PR_BRANCH_NAME }}"; then
80-
timeout 3600 bash -c 'until [[ $(gh pr view '${{ env.PR_BRANCH_NAME }}' --json state --jq .state) == "MERGED" ]]; do sleep 5 && echo "$(gh pr view '${{ env.PR_BRANCH_NAME }}' --json state --jq .state)"; done'
81-
fi
82-
env:
83-
GITHUB_TOKEN: ${{ github.TOKEN }}
8463
- name: Create Github release
8564
uses: ncipollo/release-action@v1
8665
with:

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ node_modules
1313
ui-tests/playwright-report
1414
ui-tests/test-results
1515
/src/codeflare_sdk.egg-info/
16+
docs/sphinx/_build

0 commit comments

Comments
 (0)
Please sign in to comment.