Skip to content

Commit

Permalink
Add generate-jazzy-docs.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
okhan-okbay-cko committed Sep 19, 2023
1 parent 7cadfa7 commit 159e5f4
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 5 deletions.
6 changes: 2 additions & 4 deletions .github/scripts/buildDocs.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
#!/bin/sh


FRAMES_JSON=Frames.json
CHECKOUT_JSON=Checkout.json

# generate sourcekitten JSONs for modules
echo "Parsing Frames"
sourcekitten doc -- -workspace "iOS Example Frame/iOS Example Frame.xcworkspace" -scheme Frames -destination generic/platform=iOS > $FRAMES_JSON
echo ""

echo "Parsing Checkout"
sourcekitten doc -- -workspace Checkout/CocoapodsSample/CheckoutCocoapodsSample.xcworkspace -scheme Checkout -destination generic/platform=iOS > $CHECKOUT_JSON
echo ""
sourcekitten doc -- -workspace Checkout/Samples/CocoapodsSample/CheckoutCocoapodsSample.xcworkspace -scheme Checkout -destination generic/platform=iOS > $CHECKOUT_JSON

# combine JSONs to build jazzy docs
echo "Building docs"
jazzy --sourcekitten-sourcefile $FRAMES_JSON,$CHECKOUT_JSON
echo ""

# cleanup JSONs
echo "Cleaning up..."
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/generate-jazzy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Generate Jazzy Docs

#workflow_dispatch

on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- 'main'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
generate-jazzy-docs:
name: Generate Docs
runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Ruby
uses: ruby/setup-ruby@5311f05890856149502132d25c4a24985a00d426
with:
ruby-version: 3.2.2

- name: Install SourceKitten
run: |
brew install sourcekitten
- name: Install Jazzy
run: |
gem install jazzy
- name: Pod Install Frames
run: |
cd "iOS Example Frame"
pod install
- name: Pod Install Checkout
run: |
cd "Checkout/Samples/CocoapodsSample"
pod install
- name: Generate Docs
run: sh .github/scripts/buildDocs.sh

- name: Create Pull Request
env:
BRANCH_NAME: "update/jazzy-docs"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git branch $BRANCH_NAME
git checkout $BRANCH_NAME
git add .
git commit -m "Update jazzy docs"
git push -u origin $BRANCH_NAME
gh pr create -t "Update Jazzy Docs" -b "Automated Update for Jazzy Docs"
2 changes: 1 addition & 1 deletion .jazzy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ author_url: https://www.checkout.com/
source_host: github
source_host_url: https://github.com/checkout/frames-ios
source_host_files_url: https://github.com/checkout/frames-ios/tree/main
output: docs
output: .github/docs
theme: .jazzy/.themes/checkout.com
clean: true
documentation: Documentation/**/*.md
Expand Down

0 comments on commit 159e5f4

Please sign in to comment.