-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ci): add ci build for documentation
Also deactivated megalinter since it doesn't help with Swift.
- Loading branch information
1 parent
c89b429
commit f59c2bd
Showing
13 changed files
with
224 additions
and
52 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,14 +15,14 @@ jobs: | |
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Mega-Linter | ||
id: ml | ||
uses: megalinter/megalinter@v6 | ||
env: | ||
VALIDATE_ALL_CODEBASE: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | ||
DISABLE: COPYPASTE,SPELL | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
DISABLE_LINTERS: SWIFT_SWIFTLINT,YAML_V8R,REPOSITORY_DEVSKIM,REPOSITORY_TRIVY,REPOSITORY_GITLEAKS | ||
# - name: Mega-Linter | ||
# id: ml | ||
# uses: megalinter/megalinter@v6 | ||
# env: | ||
# VALIDATE_ALL_CODEBASE: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | ||
# DISABLE: COPYPASTE,SPELL | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# DISABLE_LINTERS: SWIFT_SWIFTLINT,YAML_V8R,REPOSITORY_DEVSKIM,REPOSITORY_TRIVY,REPOSITORY_GITLEAKS | ||
|
||
- name: SwiftLint | ||
uses: norio-nomura/[email protected] | ||
|
@@ -31,11 +31,11 @@ jobs: | |
env: | ||
DIFF_BASE: ${{ github.base_ref }} | ||
|
||
- name: Archive production artifacts | ||
if: success() || failure() | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: Mega-Linter reports | ||
path: | | ||
report | ||
mega-linter.log | ||
# - name: Archive production artifacts | ||
# if: success() || failure() | ||
# uses: actions/upload-artifact@v2 | ||
# with: | ||
# name: Mega-Linter reports | ||
# path: | | ||
# report | ||
# mega-linter.log |
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,59 @@ | ||
--- | ||
name: Release Documentation | ||
|
||
on: | ||
# push: | ||
# branches: | ||
# - main | ||
pull_request: | ||
branches: [main] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
docs: | ||
name: build documentation and release | ||
runs-on: macos-latest | ||
env: | ||
GITHUB_ACTOR: ${{ github.actor }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install SSH Key | ||
uses: shimataro/[email protected] | ||
with: | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
known_hosts: github.com | ||
|
||
- name: Adding Known Hosts | ||
run: ssh-keyscan -H github.com >> ~/.ssh/known_hosts | ||
|
||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 3.0 | ||
bundler-cache: true | ||
|
||
- name: Install Jazzy | ||
run: sudo gem install jazzy | ||
|
||
- name: ABC Install | ||
uses: lyricwulf/abc@v1 | ||
with: | ||
macos: sourcekitten | ||
|
||
- name: Build Docs | ||
run: ./.scripts/buildDocs.sh | ||
|
||
- name: Push | ||
uses: s0/git-publish-subdir-action@develop | ||
env: | ||
REPO: self | ||
BRANCH: gh-pages # The branch name where you want to push the assets | ||
FOLDER: docs # The directory where your assets are generated | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub will automatically add this - you don't need to bother getting a token | ||
MESSAGE: "feat(docs): ({sha}) {msg}" # The commit message |
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 |
---|---|---|
|
@@ -42,3 +42,5 @@ protobuf/*.swift | |
Sources/PrismSwiftSDK/protobuf | ||
OpenAPI | ||
Package.resolved | ||
docs | ||
Documentation |
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,5 @@ | ||
{ | ||
"string-replacements": { | ||
"<doc:PrismAgentErrors>": "[Prism Agent Errors](prismagenterrors.html)" | ||
} | ||
} |
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,53 @@ | ||
# .jazzy.yaml | ||
|
||
# General configuration options | ||
module: AtalaPrismSDK | ||
author: IOG | ||
github_url: https://github.com/input-output-hk/atala-prism-wallet-sdk-swift | ||
|
||
# Source directory and files to include | ||
#source: | ||
# - MyLibrary/ | ||
# - README.md | ||
|
||
# Markdown files to include | ||
documentation: | ||
- 'Documentation/*.md' | ||
|
||
custom_categories: | ||
- name: Getting Started | ||
children: | ||
- AtalaPrismSDK | ||
- Mediation | ||
- Logging | ||
- name: Architecture | ||
children: | ||
- BuildingBlocks | ||
- TechnicalConsiderations | ||
- ModularApproach | ||
- name: Error Handling | ||
children: | ||
- ErrorHandling | ||
- ApolloErrors | ||
- CastorErrors | ||
- MercuryErrors | ||
- PlutoErrors | ||
- PrismAgentErrors | ||
- name: Prism Agent | ||
children: | ||
- PrismAgent | ||
- PrismAgentTutorials | ||
- name: Apollo | ||
children: | ||
- Apollo | ||
- ApolloTutorials | ||
- name: Castor | ||
children: | ||
- Castor | ||
- CastorTutorials | ||
- name: Pluto | ||
children: | ||
- Pluto | ||
- name: Pollux | ||
children: | ||
- Pollux |
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,20 @@ | ||
#!/bin/sh | ||
|
||
# Sourcekitten all modules so we can merge them | ||
sourcekitten doc -- -scheme AtalaPrismSDK -destination "name=iPhone 14" > AtalaPrismSDK.json | ||
sourcekitten doc -- -scheme Domain -destination "name=iPhone 14" > Domain.json | ||
sourcekitten doc -- -scheme Apollo -destination "name=iPhone 14" > Apollo.json | ||
sourcekitten doc -- -scheme Mercury -destination "name=iPhone 14" > Mercury.json | ||
sourcekitten doc -- -scheme Pluto -destination "name=iPhone 14" > Pluto.json | ||
sourcekitten doc -- -scheme Pollux -destination "name=iPhone 14" > Pollux.json | ||
sourcekitten doc -- -scheme PrismAgent -destination "name=iPhone 14" > PrismAgent.json | ||
|
||
# Copy all the *.md files to the Documentation folder | ||
bash ./.scripts/prepareDocumentation.sh | ||
# Replace every <doc:XxYy> by [Xx Yy](xxyy.html) | ||
ruby ./.scripts/preDoc.rb | ||
|
||
# It needs to be castor module since the sourcekitten is adding the Protobuf files. | ||
jazzy --module Castor --sourcekitten-sourcefile AtalaPrismSDK.json,Domain.json,Apollo.json,Mercury.json,Pluto.json,Pollux.json,PrismAgent.json --theme fullwidth --hide-documentation-coverage | ||
# Replace in the index the Castor references by Atala Prism SDK | ||
ruby ./.scripts/prepareIndex.rb |
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,28 @@ | ||
require 'json' | ||
|
||
# Read the string-replacements from the .jazzy.json file | ||
jazzy_conf = JSON.parse(File.read('.jazzy.json')) | ||
transforms = jazzy_conf['string-replacements'] | ||
|
||
# Loop through all .md files in the Documentation directory | ||
Dir.glob('Documentation/*.md').each do |file| | ||
# Read the contents of the file | ||
contents = File.read(file) | ||
|
||
# Apply all replacements to the contents of the file | ||
if transforms | ||
transforms.each_pair do |key, value| | ||
contents = contents.gsub(key, value) | ||
end | ||
end | ||
|
||
# Replace <doc:AnythingAndSomething> with a link to anythingandsomething.html | ||
contents = contents.gsub(/<doc:([\w\s]+)>/) do |match| | ||
name = match.gsub('<doc:', '').gsub('>', '').gsub(/(.)([A-Z])/,'\1 \2') | ||
link = name.downcase.gsub(' ', '') + '.html' | ||
"[#{name}](#{link})" | ||
end | ||
|
||
# Write the updated contents back to the file | ||
File.write(file, contents) | ||
end |
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,24 @@ | ||
#!/bin/bash | ||
|
||
# Create the output directory if it doesn't exist | ||
mkdir -p "Documentation/" | ||
|
||
# Find all subfolders in the current directory and loop through them | ||
find AtalaPrismSDK -type d | while read dir | ||
do | ||
# Check if the folder name contains ".docc" | ||
if [[ "$dir" == *".docc"* ]] | ||
then | ||
# Copy .md files if they exist | ||
if [ -n "$(find "$dir" -maxdepth 1 -name '*.md' -print -quit)" ] | ||
then | ||
cp -p "$dir"/*.md "Documentation/" | ||
fi | ||
|
||
# Copy .png files if they exist | ||
if [ -n "$(find "$dir" -maxdepth 1 -name '*.png' -print -quit)" ] | ||
then | ||
cp -p "$dir"/*.png "Documentation/" | ||
fi | ||
fi | ||
done |
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,7 @@ | ||
File.open('docs/index.html', 'r+') do |file| | ||
content = file.read | ||
content.gsub!('Castor Reference', 'Atala PRISM SDK Reference') | ||
content.gsub!('Castor Docs', 'Atala PRISM SDK Docs') | ||
file.rewind | ||
file.write(content) | ||
end |
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
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