Skip to content

Commit d68e99f

Browse files
authored
Add DocC deployment template (#13)
* Add `DocC` deployment template * Add `CHANGELOG.md`
1 parent da081d2 commit d68e99f

4 files changed

Lines changed: 65 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.
44
## [Unreleased]
55

66
## Added
7+
- Add `DocC` deployment template
8+
- Added in Pull Request[#13](https://github.com/space-code/package-template/pull/13).
79
- Add additional badges to `README.md`
810
- Added in Pull Request [#12](https://github.com/space-code/package-template/pull/12).
911
- Add files to comply with community standards

cookiecutter.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,9 @@
2323
"additional_badges": [
2424
"Yes",
2525
"No"
26+
],
27+
"deploy_docc": [
28+
"Yes",
29+
"No"
2630
]
2731
}

hooks/post_gen_project.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import os
2+
import shutil
3+
4+
print(os.getcwd())
5+
6+
def remove(filepath):
7+
if os.path.isfile(filepath):
8+
os.remove(filepath)
9+
elif os.path.isdir(filepath):
10+
shutil.rmtree(filepath)
11+
12+
create_docc = '{{ cookiecutter.deploy_docc }}' == 'yes'
13+
14+
if not create_docc:
15+
remove(os.path.join(os.getcwd(), '.github/workflows', 'deploy_docc.yml'))
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Deploy DocC
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: "pages"
15+
cancel-in-progress: true
16+
17+
jobs:
18+
deploy:
19+
environment:
20+
name: github-pages
21+
{% raw %}
22+
url: ${{ steps.deployment.outputs.page_url }}
23+
{% endraw %}
24+
runs-on: macos-12
25+
steps:
26+
- name: Checkout 🛎️
27+
uses: actions/checkout@v3
28+
- name: Build DocC
29+
run: |
30+
swift build;
31+
swift package \
32+
--allow-writing-to-directory ./docs \
33+
generate-documentation \
34+
--target {{ cookiecutter.name }} \
35+
--output-path ./docs \
36+
--transform-for-static-hosting \
37+
--hosting-base-path {{ cookiecutter.name | lower }};
38+
- name: Upload artifact
39+
uses: actions/upload-pages-artifact@v1
40+
with:
41+
path: 'docs'
42+
- name: Deploy to GitHub Pages
43+
id: deployment
44+
uses: actions/deploy-pages@v1

0 commit comments

Comments
 (0)