This repository was archived by the owner on Oct 17, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
122 lines (104 loc) · 3.45 KB
/
docs.yml
File metadata and controls
122 lines (104 loc) · 3.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: Build and Deploy Docusaurus with KDocs
on:
push:
branches:
- main
workflow_dispatch:
repository_dispatch:
types: [kotlin-repo-updated]
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build:
name: Build Docusaurus with KDocs
runs-on: ubuntu-latest
steps:
- name: Checkout Docusaurus Repository
uses: actions/checkout@v4
with:
path: docusaurus-repo
- name: Checkout Kotlin Repository
uses: actions/checkout@v4
with:
repository: VishnuSanal/multipaz-identity-credential
path: kotlin-repo
ref: 'main'
fetch-depth: 0
fetch-tags: true
- name: Get Kotlin Repo Commit Hash
id: kotlin-commit
run: |
cd kotlin-repo
COMMIT_HASH=$(git rev-parse HEAD)
echo "commit_hash=$COMMIT_HASH" >> $GITHUB_OUTPUT
echo "Latest commit hash: $COMMIT_HASH"
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
# Cache the Dokka output using the commit hash
- name: Cache KDocs
id: cache-kdocs
uses: actions/cache@v3
with:
path: kotlin-repo/build/dokka
key: kdocs-${{ steps.kotlin-commit.outputs.commit_hash }}
# Only run Dokka if there was a cache miss
- name: Generate KDocs with Dokka
if: steps.cache-kdocs.outputs.cache-hit != 'true'
run: |
cd kotlin-repo
./gradlew dokkaHtmlMultiModule
echo "KDocs generated successfully"
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: docusaurus-repo/package-lock.json
- name: Create API directory in Docusaurus static folder
run: mkdir -p docusaurus-repo/static/kdocs
- name: Copy KDocs and markdown files to Docusaurus
run: ./docusaurus-repo/copy_docs.sh
- name: Install Docusaurus dependencies
run: |
cd docusaurus-repo
npm ci
- name: Build Docusaurus website
env:
NODE_ENV: production
DOCUSAURUS_URL: https://${{ github.repository_owner }}.github.io
# Dynamic baseUrl: PRODUCTION uses /, otherwise uses /repository-name/
DOCUSAURUS_BASEURL: ${{ vars.WEBSITE_ENVIRONMENT == 'PRODUCTION' && '/' || format('/{0}/', github.event.repository.name) }}
run: |
cd docusaurus-repo
# Debug: Show the resolved baseUrl and environment
echo "Resolved DOCUSAURUS_BASEURL: $DOCUSAURUS_BASEURL"
echo "WEBSITE_ENVIRONMENT: ${{ vars.WEBSITE_ENVIRONMENT }}"
# Include the current date in the build for versioning
echo "Build date: $(date +'%Y-%m-%d %H:%M:%S')" > src/build-info.json
npm run build
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docusaurus-repo/build
deploy:
name: Deploy to GitHub Pages
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4