Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.
## [Unreleased]

## Added
- Add `DocC` deployment template
- Added in Pull Request[#13](https://github.com/space-code/package-template/pull/13).
- Add additional badges to `README.md`
- Added in Pull Request [#12](https://github.com/space-code/package-template/pull/12).
- Add files to comply with community standards
Expand Down
4 changes: 4 additions & 0 deletions cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,9 @@
"additional_badges": [
"Yes",
"No"
],
"deploy_docc": [
"Yes",
"No"
]
}
15 changes: 15 additions & 0 deletions hooks/post_gen_project.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import os
import shutil

print(os.getcwd())

def remove(filepath):
if os.path.isfile(filepath):
os.remove(filepath)
elif os.path.isdir(filepath):
shutil.rmtree(filepath)

create_docc = '{{ cookiecutter.deploy_docc }}' == 'yes'

if not create_docc:
remove(os.path.join(os.getcwd(), '.github/workflows', 'deploy_docc.yml'))
44 changes: 44 additions & 0 deletions {{ cookiecutter.name | lower }}/.github/workflows/deploy_docc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Deploy DocC

on:
push:
branches:
- main

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: true

jobs:
deploy:
environment:
name: github-pages
{% raw %}
url: ${{ steps.deployment.outputs.page_url }}
{% endraw %}
runs-on: macos-12
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
- name: Build DocC
run: |
swift build;
swift package \
--allow-writing-to-directory ./docs \
generate-documentation \
--target {{ cookiecutter.name }} \
--output-path ./docs \
--transform-for-static-hosting \
--hosting-base-path {{ cookiecutter.name | lower }};
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: 'docs'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1