Skip to content

Commit

Permalink
Merge pull request #131 from stakater/mto-version
Browse files Browse the repository at this point in the history
Enable setting latest doc version for multiple versioned doc
  • Loading branch information
rasheedamir authored Nov 14, 2024
2 parents f936bdc + a0d4796 commit 1ddb7e3
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 23 deletions.
27 changes: 17 additions & 10 deletions .github/workflows/branch_deleted.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,35 @@ name: Deleting a branch for versioned doc

on:
workflow_call:
inputs:
LATEST_DOC_VERSION:
description: Define the latest doc version for multiple versioned doc
required: true
type: string
secrets:
GH_TOKEN:
description: "GitHub token"
required: true

jobs:
delete:
check:
if: github.event.ref_type == 'branch'
runs-on: ubuntu-latest
outputs:
matched: ${{ steps.branch_check.outputs.matched }}
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 }}

delete:
needs: check
if: needs.check.outputs.matched == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout source files
if: steps.branch_check.outputs.matched == 'true'
uses: actions/checkout@v4
with:
fetch-depth: 0
Expand All @@ -29,33 +39,30 @@ jobs:
token: ${{ secrets.GH_TOKEN }}

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

- name: Install mike
if: steps.branch_check.outputs.matched == 'true'
run: pip3 install mike

- name: Run prepare_theme.sh script from repository to merge theme_common and theme_override folders
if: steps.branch_check.outputs.matched == 'true'
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'
- name: Delete the version and all its aliases from the branch
run: mike delete --push ${{ github.event.ref }}

- name: Update 'latest' alias to latest doc version
run: mike alias --push --update-aliases ${{ inputs.LATEST_DOC_VERSION }} latest

- name: Push Latest Tag
if: steps.branch_check.outputs.matched == 'true'
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/push_versioned_doc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: Push versioned doc

on:
workflow_call:
inputs:
LATEST_DOC_VERSION:
description: Define the latest doc version for multiple versioned doc
required: true
type: string
secrets:
GH_TOKEN:
description: "GitHub token"
Expand Down Expand Up @@ -40,10 +45,10 @@ jobs:
- name: Deploy content
run: mike deploy --push ${{ github.ref_name }}

- name: Set alias
run: mike alias --push main latest
- name: Update 'latest' alias to latest doc version
run: mike alias --push --update-aliases ${{ inputs.LATEST_DOC_VERSION }} latest

- name: Set default doc version
- name: When publishing a new version, always update the alias to point to the latest version
run: mike set-default --push latest

- name: Push Latest Tag
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/rdlm_acquire.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ on:
description: "Wait time for the resource to acquire"
required: true
type: string

RDLM_URL:
description: "Service path of the RDLM server running on the cluster"
required: true
type: string

jobs:
acquire-resource:
name: Acquire lock
runs-on: ${{ inputs.RESOURCE_NAME }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Run acquire.sh
env:
RDLM_URL: ${{ inputs.RDLM_URL }}
run: |
bash .github/scripts/rdlm_acquire.sh ${{ inputs.RESOURCE_NAME }} ${{ inputs.LIFETIME }} ${{ inputs.WAIT }}
bash .github/scripts/rdlm_acquire.sh ${{ inputs.RESOURCE_NAME }} ${{ inputs.LIFETIME }} ${{ inputs.WAIT }}
10 changes: 5 additions & 5 deletions .github/workflows/rdlm_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ on:
description: "Name of the resource to release"
required: true
type: string

RDLM_URL:
description: "Service path of the RDLM server running on the cluster"
required: true
type: string

jobs:
release-resource:
name: Release lock
runs-on: ${{ inputs.RESOURCE_NAME }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Run release.sh
env:
RDLM_URL: ${{ inputs.RDLM_URL }}
run: |
bash .github/scripts/rdlm_release.sh ${{ inputs.RESOURCE_NAME }}
bash .github/scripts/rdlm_release.sh ${{ inputs.RESOURCE_NAME }}

0 comments on commit 1ddb7e3

Please sign in to comment.