Skip to content

Commit

Permalink
feat(ci): include client doc in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
olivierapivideo committed Sep 6, 2023
1 parent f7428a3 commit 9de744a
Show file tree
Hide file tree
Showing 14 changed files with 71 additions and 3,258 deletions.
68 changes: 67 additions & 1 deletion .github/workflows/update-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ jobs:
assignees: ${{ join(github.event.pull_request.assignees.*.login) }}
# reviewers: ${{ join(github.event.pull_request.requested_reviewers.*.login) }} #TODO
# draft: true
- name: Archive production artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.profile.name }}-documentation-artifact
path: |
${{ env.CLIENT_PATH }}/README.md
- name: Check tests results
uses: apivideo/[email protected]
if: ${{ steps.cpr.outputs.pull-request-head-sha }}
Expand All @@ -94,6 +100,58 @@ jobs:
owner: ${{ github.repository_owner }}
sha: ${{ steps.cpr.outputs.pull-request-head-sha }}

generate_documentation:
if: github.event.action != 'closed'
runs-on: ubuntu-latest
needs: [update_client_pr]
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Download all workflow run artifacts
uses: actions/download-artifact@v3
# print a debug message
- run: |
for dir in *-documentation-artifact; do
if [ -d "$dir" ]; then
prefix=$(echo "$dir" | sed 's/-documentation-artifact//')
if [ -f "$dir/README.md" ]; then
cp "$dir/README.md" "templates/documentation/sdks/api-clients/apivideo-${prefix}-client.md"
fi
fi
done
ls -la templates/documentation/sdks/api-clients/
- name: Checkout client repository
uses: actions/checkout@v2
with:
repository: ${{ github.repository_owner }}/api.video-documentation
token: ${{ secrets.PAT }}
path: generated-clients/documentation
- name: Copy documentation files
run: |
cp -R templates/documentation/* generated-clients/documentation
cp -R templates/documentation/.github generated-clients/documentation
cp -R oas_apivideo.yaml generated-clients/documentation/openapi.yaml
- uses: peter-evans/create-pull-request@v3
id: cpr
with:
token: ${{ secrets.PAT }}
path: generated-clients/documentation
commit-message: ${{ github.event.pull_request.title }}
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
branch: ${{ github.event.pull_request.head.ref }}
title: ${{ github.event.pull_request.title }}
body: |
> ${{ github.event.pull_request.body }}
> Created by @${{ github.actor }} via ${{ github.event.pull_request.html_url }}
delete-branch: true
labels: ${{ join(github.event.pull_request.labels.*.name) }}
assignees: ${{ join(github.event.pull_request.assignees.*.login) }}


merge_client_pr:
# this job will only run if the PR has been merged
if: github.event.action == 'closed' && github.event.pull_request.merged == true
Expand Down Expand Up @@ -155,4 +213,12 @@ jobs:
});
} else {
console.log(`There are no PRs from branch ${context.payload.pull_request.head.ref} on ${process.env.CLIENT_REPOSITORY} repository.`);
}
}
for f of *; do
case $f in
*-clients)
print $f
;;
esac
done
6 changes: 0 additions & 6 deletions config/documentation.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@
</modules>

<profiles>
<profile>
<id>documentation</id>
<properties>
<configFileName>documentation</configFileName>
<outputFolder>documentation</outputFolder>
<templateFolder>documentation</templateFolder>
<generatorName>org.openapitools.codegen.DefaultCodegen</generatorName>
<postGenerationScript>./post-generate.sh</postGenerationScript>
</properties>
</profile>
<profile>
<id>android</id>
<properties>
Expand Down
4 changes: 0 additions & 4 deletions templates/documentation/post-generate.sh

This file was deleted.

4 changes: 2 additions & 2 deletions templates/documentation/sdks/api-clients/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ Seamlessly integrate video on demand or live streaming into your current tech st

{% include "_partials/hagrid-item.md" title: "Java", image: "https://s3.eu-central-1.amazonaws.com/api.video-strapi/java_1b6f259caf.svg", subtitle: "API client", link: "././apivideo-java-client.md" %}

{% include "_partials/hagrid-item.md" title: "Swift", image: "https://s3.eu-central-1.amazonaws.com/api.video-strapi/swift_b6e888925d.svg", subtitle: "API client", link: "././ios-api-client.md" %}
{% include "_partials/hagrid-item.md" title: "Swift", image: "https://s3.eu-central-1.amazonaws.com/api.video-strapi/swift_b6e888925d.svg", subtitle: "API client", link: "././apivideo-swift5-client.md" %}

{% include "_partials/hagrid-item.md" title: "Kotlin", image: "https://s3.eu-central-1.amazonaws.com/api.video-strapi/android_4356dd4e0c.svg", subtitle: "API client", link: "././android-api-client.md" %}
{% include "_partials/hagrid-item.md" title: "Kotlin", image: "https://s3.eu-central-1.amazonaws.com/api.video-strapi/android_4356dd4e0c.svg", subtitle: "API client", link: "././apivideo-android-client.md" %}

</div>
Loading

0 comments on commit 9de744a

Please sign in to comment.