Skip to content

Commit

Permalink
Add DocC deployment template (#13)
Browse files Browse the repository at this point in the history
* Add `DocC` deployment template

* Add `CHANGELOG.md`
  • Loading branch information
nik3212 authored Jan 13, 2024
1 parent da081d2 commit d68e99f
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 0 deletions.
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

0 comments on commit d68e99f

Please sign in to comment.