-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add `DocC` deployment template * Add `CHANGELOG.md`
- Loading branch information
Showing
4 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,5 +23,9 @@ | |
"additional_badges": [ | ||
"Yes", | ||
"No" | ||
], | ||
"deploy_docc": [ | ||
"Yes", | ||
"No" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
44
{{ cookiecutter.name | lower }}/.github/workflows/deploy_docc.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |