Skip to content

Commit

Permalink
feat(workflows): Publish Generated Docs (#249)
Browse files Browse the repository at this point in the history
PR: #249
  • Loading branch information
osama-salman99 authored Oct 4, 2023
1 parent 0ced914 commit 6efa2e0
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 17 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/generate-sdk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,28 @@ jobs:
run: |
echo ${{ github.event.inputs.name }}
./scripts/generator-main.sh -n "${{ inputs.name }}" -v "${{ inputs.version }}" -i ./specs.yaml
- name: generate-docs
working-directory: expediagroup/sdk/docsgen
run: |
python3 -m venv env
source env/bin/activate
pip3 install -r "../../../requirements-docs.txt"
pip3 install -r "../../../requirements-dev.txt"
namespace="$(echo "${{ inputs.name }}" | tr '[:upper:]' '[:lower:]')"
mkdir -p "temp/expediagroup/sdk/$namespace"
cp "../generator/package/expediagroup/sdk/$namespace/__init__.py" "./temp/expediagroup/__init__.py"
cp "../generator/package/expediagroup/sdk/$namespace/__init__.py" "./temp/expediagroup/sdk/__init__.py"
cp "../generator/package/expediagroup/sdk/$namespace/__init__.py" "./temp/expediagroup/sdk/$namespace/__init__.py"
cp "../generator/package/expediagroup/sdk/$namespace/client.py" "./temp/expediagroup/sdk/$namespace/client.py"
cp "../generator/package/expediagroup/sdk/$namespace/model.py" "./temp/expediagroup/sdk/$namespace/model.py"
python3 ./__main__.py -p ./temp -n "$namespace"
- uses: actions/upload-artifact@v3
with:
name: sdk
path: expediagroup/sdk/generator/package/dist
- uses: actions/upload-artifact@v3
with:
name: docs
path: expediagroup/sdk/docsgen/docs
41 changes: 24 additions & 17 deletions .github/workflows/generator-publish-sources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- uses: actions/download-artifact@v3
with:
name: sdk
Expand All @@ -24,26 +27,30 @@ jobs:
with:
name: specs
path: expediagroup/sdk/generator/package
- name: Publish Code
- uses: actions/download-artifact@v3
with:
name: docs
path: expediagroup/sdk/generator/package/docs
- name: Prepare Code
working-directory: expediagroup/sdk/generator/package
run: |
git config --global user.email "oss@expediagroup.com"
git config --global user.name "Expedia Group Open Source"
rm -rf ../../../../release/"${{github.event.inputs.name}}"
mkdir -p ../../../../release/"${{github.event.inputs.name}}"
mkdir -p ../../../../release/"${{github.event.inputs.name}}/src"
tar -xzf *.tar.gz
rm *.tar.gz
find ./ -name \*.py -exec cp {} ../../../../release/"${{github.event.inputs.name}}"/ \;
find ./ -name \*.yaml -exec cp {} ../../../../release/"${{github.event.inputs.name}}"/ \;
git fetch --depth=1 origin main
git checkout -b "${{github.event.inputs.name}}-${{github.event.inputs.version}}"
git add ../../../../release/\*
cd ../../../..
pip install -r ../../../../requirements-dev.txt
cp -r ./docs ../../../../release/"${{github.event.inputs.name}}"/
find ./ -name \*.py -exec cp {} ../../../../release/"${{github.event.inputs.name}}"/src/ \;
find ./ -name \*.yaml -exec cp {} ../../../../release/"${{github.event.inputs.name}}"/src/ \;
- name: Format Code
working-directory: release
run: |
pip3 install -r ../requirements-dev.txt
black .
cd -
git commit -m "chore: Publish ${{github.event.inputs.name}} [${{github.event.inputs.version}}] SDK"
git push --set-upstream origin "${{github.event.inputs.name}}-${{github.event.inputs.version}}"
gh pr create -B main -H "${{github.event.inputs.name}}-${{github.event.inputs.version}}" --title 'chore: Publish ${{github.event.inputs.name}} [${{github.event.inputs.version}}] SDK' --fill
env:
GH_TOKEN: ${{ github.token }}
- name: Create PR
uses: peter-evans/create-pull-request@v5
with:
branch: "${{github.event.inputs.name}}-${{github.event.inputs.version}}"
commit-message: "chore: Publish ${{github.event.inputs.name}} [${{github.event.inputs.version}}] SDK"
title: "chore: Publish ${{github.event.inputs.name}} [${{github.event.inputs.version}}] SDK"
add-paths: |
release/*

0 comments on commit 6efa2e0

Please sign in to comment.