Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/scripts/api_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,13 @@ def create_pr_or_update_branch_on_api_repo(
print(f"Switching to branch: {branch_name}")
api_repo.git.checkout('-B', branch_name)

# Pull remote branch contents if it exists so we commit on top
try:
api_repo.git.pull('origin', branch_name)
print(f"Pulled latest from origin/{branch_name}")
except GitCommandError:
print(f"No existing remote branch '{branch_name}' to pull.")

# Create repo directory if it doesn't exist
repo_dir = os.path.join(temp_dir, repo_name)
os.makedirs(repo_dir, exist_ok=True)
Expand Down Expand Up @@ -250,11 +257,8 @@ def create_pr_or_update_branch_on_api_repo(
print("Adding remote 'origin' with access token")
origin = api_repo.create_remote("origin", auth_url)

# Force Push because we allow APIs for a specific version to
# reflect the latest representation of the version/ref.
print(f"Pushing branch to remote...")
api_repo.git.push('--force', '--set-upstream',
'origin', branch_name)
api_repo.git.push('--set-upstream', 'origin', branch_name)

# Check if PR already exists
existing_pr = check_existing_pr(
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/api_docs_gen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ on:
dry_run:
type: boolean
default: false
api_deploy_version:
type: string
default: 5.x.y

jobs:
generate_api_docs:
Expand All @@ -51,7 +54,9 @@ jobs:
- run: pip install -r ${{ inputs.dir }}/docs/requirements.txt gitpython requests
- run: conan config install https://github.com/libhal/conan-config2.git
- run: conan hal docs --doc_version ${{ inputs.version }} ${{ inputs.dir }}/docs
- run: wget https://raw.githubusercontent.com/libhal/ci/5.x.y/.github/scripts/api_deploy.py
- name: print api docs version name
run: echo ${{ inputs.api_deploy_version }}
- run: wget https://raw.githubusercontent.com/libhal/ci/${{ inputs.api_deploy_version }}/.github/scripts/api_deploy.py
- name: Deploy to API repo
if: ${{ inputs.dry_run == false }}
run: python api_deploy.py deploy --version ${{ inputs.version }} --repo-name ${{ inputs.repo_name }} --docs-dir ${{ inputs.dir }}/docs/build/
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/self_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
filters: |
api_docs:
- '.github/workflows/api_docs_gen.yml'
- '.github/scripts/api_deploy.yml'
library_check:
- '.github/workflows/library_check.yml'
tests:
Expand All @@ -70,6 +71,7 @@ jobs:
dir: .
dry_run: true
version: main
api_deploy_version: ${{ github.head_ref }}
secrets: inherit

api_libhal_v4:
Expand All @@ -82,6 +84,7 @@ jobs:
dir: v4
dry_run: true
version: main
api_deploy_version: ${{ github.head_ref }}
secrets: inherit

library_check_libhal_v4:
Expand Down