-
Notifications
You must be signed in to change notification settings - Fork 147
78 lines (71 loc) · 2.1 KB
/
jazzy.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
name: Jazzy
on:
push:
branches: [main]
paths:
- '.github/workflows/jazzy.yml'
- '.jazzy.yaml'
- '**/*.md'
- '**/*.jpg'
- 'Gemfile*'
- 'Package*'
- 'Sources/**/*.swift'
pull_request:
paths:
- '.github/workflows/jazzy.yml'
- '.jazzy.yaml'
- '**/*.md'
- '**/*.jpg'
- 'Gemfile*'
- 'Package*'
- 'Sources/**/*.swift'
concurrency:
group: jazzy-${{ github.ref }}
cancel-in-progress: true
jobs:
Jazzy:
runs-on: macos-14
env:
DEVELOPER_DIR: /Applications/Xcode_15.4.app
steps:
- uses: actions/checkout@v4
- name: Install SourceKitten
run: brew install sourcekitten
- run: swift build
- name: Generate documentation json
run: sourcekitten doc --spm --module-name Yams > yams.json
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3.3
bundler-cache: true
- name: Run jazzy
run: bundle exec jazzy --clean --sourcekitten-sourcefile yams.json
- name: Validate documentation coverage
run: |
if ruby -rjson -e "j = JSON.parse(File.read('docs/undocumented.json')); exit j['warnings'].length != 0"; then
echo "Undocumented declarations:"
cat docs/undocumented.json
exit 1
fi
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: API Docs
path: docs
- name: Push to gh-pages
if: github.event_name == 'push'
run: |
git config --global user.email "${GITHUB_ACTOR}"
git config --global user.name "${GITHUB_ACTOR}@users.noreply.github.com"
git clone "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" out
cd out
git checkout gh-pages
git rm -rf .
cd ..
cp -a docs/. out/.
cd out
git add -A
git commit -m "Automated deployment to GitHub Pages: ${GITHUB_SHA}" --allow-empty
git push origin gh-pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}