-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
57 lines (51 loc) · 1.61 KB
/
action.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
name: "Swift Doc Deployment"
description: "Deploys the Swift documentation to GitHub pages."
branding:
icon: "code"
color: "blue"
inputs:
target:
description: "The Swift package target to generate documentation for."
required: true
branch:
description: "The branch where the documentation will be deployed."
required: false
default: "gh-pages"
name:
description: "The name for Git commits."
required: false
default: "${{github.actor}}"
email:
description: "The email address for Git commits."
required: false
default: "${{github.actor}}@users.noreply.github.com"
runs:
using: "composite"
steps:
- name: Build the Swift doc
shell: bash
run: |
mkdir -p docs
swift package --allow-writing-to-directory docs \
generate-documentation --target "${{inputs.target}}" \
--disable-indexing \
--transform-for-static-hosting \
--hosting-base-path "${{inputs.target}}" \
--output-path docs
- name: Configure Git
shell: bash
run: |
git config --global user.name "${{inputs.name}}"
git config --global user.email "${{inputs.email}}"
git config --global --add safe.directory /github/workspace
- name: Prepare the deployment branch
shell: bash
run: |
git checkout -B "${{inputs.branch}}"
git push origin "${{inputs.branch}}" -f
- name: Deploy to GitHub pages
shell: bash
run: |
git add docs/ -f
git commit -m "Deploy Swift Doc"
git push origin $(git subtree split --prefix=docs/):${{inputs.branch}} -f