-
Notifications
You must be signed in to change notification settings - Fork 3
124 lines (119 loc) · 4.96 KB
/
deploy_docs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# Simple workflow for deploying static content to GitHub Pages
name: Deploy DocC
on:
# Runs on new releases
release:
types: [published]
pull_request:
branches: [main]
push:
branches: [main]
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
env:
PACKAGE_NAME: AgoraRtcKit
BUILD_DEST: generic/platform=macOS
BUILD_PRODUCT: Debug
JSON_TEMPLATE_BASE: https://github.com/AgoraIO/agora_doc_source/releases/download/master-build/macos_ng_json_template
jobs:
generate-docc:
name: Build DocC Archives
runs-on: macos-13
strategy:
matrix:
language: ['en', 'cn']
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
- name: Switch Xcode 🔄
run: sudo xcode-select --switch /Applications/Xcode_14.3.app
- name: Clone DocC Helper 👭
uses: actions/checkout@v3
with:
repository: maxxfrazer/xcframework-to-docc
path: xcframework-to-docc
- name: Setup Xcode Project 🛠️
run: |
sh -e xcframework-to-docc/dl_framework.sh ${{ env.PACKAGE_NAME }}
sh -e xcframework-to-docc/move_header_files.sh ${{ env.PACKAGE_NAME }}.xcframework AgoraRtcKit.docc macos-arm64_x86_64
sh -e xcframework-to-docc/headers_to_xcodeproj.sh ${{ env.PACKAGE_NAME }} docc_builder
- name: Clone Python Script 👭
uses: actions/checkout@v3
with:
repository: littleGnAl/iris-doc
path: iris-doc
- name: Set up python 3.9 🐍
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Add Inline Docs (${{ matrix.language }}) 📕
run: |
cd iris-doc
python -m pip install -r requirements.txt
python iris_doc.py \
--config=$(pwd)/fmt_config/fmt_oc.yaml \
--language=oc \
--template-url=${{ env.JSON_TEMPLATE_BASE }}_${{ matrix.language }}.json \
--export-file-path=$(pwd)/../docc_builder/${{ env.PACKAGE_NAME }}/Headers/${{ env.PACKAGE_NAME }}.h
- name: Generate DocC Archive (${{ matrix.language }}) 🪄
run: xcodebuild -project docc_builder/${{ env.PACKAGE_NAME }}.xcodeproj docbuild -scheme ${{ env.PACKAGE_NAME }} -derivedDataPath /tmp/docbuild -destination ${{ env.BUILD_DEST }}
- name: Zip It Up (${{ matrix.language }}) 🤐
run: |
mv /tmp/docbuild/Build/Products/${{ env.BUILD_PRODUCT }}/${{ env.PACKAGE_NAME }}.doccarchive ${{ env.PACKAGE_NAME }}-${{ matrix.language }}.doccarchive
zip -r ${{ env.PACKAGE_NAME }}-${{ matrix.language }}.doccarchive.zip ${{ env.PACKAGE_NAME }}-${{ matrix.language }}.doccarchive
- name: Upload DocC Artifact (${{ matrix.language }}) ⬆️
uses: actions/upload-artifact@v3
with:
name: ${{ env.PACKAGE_NAME }}-${{ matrix.language }}.doccarchive.zip
path: ${{ env.PACKAGE_NAME }}-${{ matrix.language }}.doccarchive.zip
- name: Upload DocC Archive to GitHub release (${{ matrix.language }}) ⬆️
if: github.event.release
uses: svenstaro/[email protected]
with:
file: ${{ env.PACKAGE_NAME }}-${{ matrix.language }}.doccarchive.zip
asset_name: ${{ env.PACKAGE_NAME }}-${{ matrix.language }}.doccarchive.zip
tag: ${{ github.ref_name }}
publish:
name: Publish Documentation Site 🛜
if: github.event.release.prerelease == false && github.event.release.draft == false && github.event.release.tag_name == github.event.repository.default_branch
runs-on: macos-13
needs: generate-docc
strategy:
matrix:
language: ['en']
steps:
- name: Download DocC Archive ⬇️
uses: actions/download-artifact@v3
with:
name: ${{ env.PACKAGE_NAME }}-${{ matrix.language }}.doccarchive.zip
- name: Unzip Archive 😮
run: |
unzip ${{ env.PACKAGE_NAME }}-${{ matrix.language }}.doccarchive.zip
ls -li ${{ env.PACKAGE_NAME }}-${{ matrix.language }}.doccarchive
- name: lowercase Package Name 🔤
id: package-name
uses: vishalmamidi/lowercase-action@v1
with:
string: ${{ env.PACKAGE_NAME }}
- name: Build Static Website 🎈
run: |
$(xcrun --find docc) process-archive \
transform-for-static-hosting ${{ env.PACKAGE_NAME }}-en.doccarchive \
--hosting-base-path ${{ github.event.repository.name }} \
--output-path docs
echo "<script>window.location.href += \"/documentation/${{ steps.package-name.outputs.lowercase }}\"</script>" > docs/index.html
- name: Upload artifact ⬆️
uses: actions/upload-pages-artifact@v1
with:
path: 'docs'
- name: Deploy to GitHub Pages 📑
id: deployment
uses: actions/deploy-pages@v2