Skip to content

Commit

Permalink
Enable submodule checkout and adding new workflows for mkdocs related…
Browse files Browse the repository at this point in the history
… repos (#87)

* enabling submodule checkout, needed for mto-docs

* adding new workflows for mkdocs related repos. updating existing ones with submodule checkout enabled

---------

Co-authored-by: Fateh Ullah <[email protected]>
  • Loading branch information
ufateh and Fateh Ullah authored Jan 5, 2024
1 parent ab12fb6 commit 4f4b9ec
Show file tree
Hide file tree
Showing 7 changed files with 204 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/mkdocs_branch_deleted.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Deleting a branch for versioned mkdocs

on:
workflow_call:
secrets:
GH_TOKEN:
description: "GitHub token"
required: true

jobs:
delete:
if: github.event.ref_type == 'branch'
runs-on: ubuntu-latest
steps:
- name: Check if the deleted branch is a version branch
id: branch_check
uses: MeilCli/regex-match@v1
with:
regex_pattern: '^[0-9]+\.[0-9]+(\.[0-9]+)?$'
search_string: ${{ github.event.ref }}

- name: Checkout source files
if: steps.branch_check.outputs.matched == 'true'
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
persist-credentials: true
token: ${{ secrets.GH_TOKEN }}

- name: Set up Python
if: steps.branch_check.outputs.matched == 'true'
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install mike
run: pip3 install mike

- name: Run prepare_theme.sh script from repository to merge theme_common and theme_override folders
run: |
chmod +x prepare_theme.sh
./prepare_theme.sh
- name: Configure Git user
if: steps.branch_check.outputs.matched == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "stakater-user"
- name: Delete removed version
if: steps.branch_check.outputs.matched == 'true'
run: mike delete --push ${{ github.event.ref }}

- name: Push Latest Tag
if: steps.branch_check.outputs.matched == 'true'
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
WITH_V: true
DEFAULT_BUMP: patch
43 changes: 43 additions & 0 deletions .github/workflows/mkdocs_pull_request_closed.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Closing a pull request for versioned mkdocs

on:
workflow_call:
secrets:
GH_TOKEN:
description: "GitHub token"
required: true

jobs:
push:
runs-on: ubuntu-latest
steps:
- name: Checkout source files
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
persist-credentials: true
token: ${{ secrets.GH_TOKEN }}

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install mike
run: pip3 install mike

- name: Run prepare_theme.sh script from repository to merge theme_common and theme_override folders
run: |
chmod +x prepare_theme.sh
./prepare_theme.sh
- name: Configure Git user
run: |
git config --local user.email "[email protected]"
git config --local user.name "stakater-user"
- name: Delete redundant PR deployment
env:
HEAD_REF: ${{ github.head_ref }}
run: mike delete --push -b pull-request-deployments ${HEAD_REF//\//-}
43 changes: 43 additions & 0 deletions .github/workflows/mkdocs_pull_request_versioned_doc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Pull request for versioned mkdocs

on:
workflow_call:
secrets:
GH_TOKEN:
description: "GitHub token"
required: true

jobs:
deploy_doc:
runs-on: ubuntu-latest
steps:
- name: Checkout source files
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
persist-credentials: true
token: ${{ secrets.GH_TOKEN }}

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install mike
run: pip3 install mike

- name: Run prepare_theme.sh script from repository to merge theme_common and theme_override folders
run: |
chmod +x prepare_theme.sh
./prepare_theme.sh
- name: Configure git user
run: |
git config --local user.email "[email protected]"
git config --local user.name "stakater-user"
- name: Deploy PR docs
env:
HEAD_REF: ${{ github.head_ref }}
run: mike deploy --push -b pull-request-deployments ${HEAD_REF//\//-}
54 changes: 54 additions & 0 deletions .github/workflows/mkdocs_push_versioned_doc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Push versioned mkdocs

on:
workflow_call:
secrets:
GH_TOKEN:
description: "GitHub token"
required: true

jobs:
push:
runs-on: ubuntu-latest
steps:
- name: Checkout source files
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
persist-credentials: true
token: ${{ secrets.GH_TOKEN }}

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install mike
run: pip3 install mike

- name: Run prepare_theme.sh script from repository to merge theme_common and theme_override folders
run: |
chmod +x prepare_theme.sh
./prepare_theme.sh
- name: Configure Git user
run: |
git config --local user.email "[email protected]"
git config --local user.name "stakater-user"
- name: Deploy content
run: mike deploy --push ${{ github.ref_name }}

- name: Set alias
run: mike alias --push main latest

- name: Set default doc version
run: mike set-default --push latest

- name: Push Latest Tag
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
WITH_V: true
DEFAULT_BUMP: patch
1 change: 1 addition & 0 deletions .github/workflows/push_container_only.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
- name: Check out code
uses: actions/checkout@v4
with:
submodules: recursive
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
- name: Check out code
uses: actions/checkout@v4
with:
submodules: recursive
persist-credentials: false # otherwise your personal token will be used
fetch-depth: 0 # otherwise you will fail to push refs to dest repo

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
- name: Check out code
uses: actions/checkout@v4
with:
submodules: recursive
persist-credentials: false # otherwise your personal token will be used
fetch-depth: 0 # otherwise you will fail to push refs to dest repo

Expand Down

0 comments on commit 4f4b9ec

Please sign in to comment.