Skip to content

Commit 8d23f2c

Browse files
committed
refactor: update publish-docs.yml
1 parent 205b79c commit 8d23f2c

File tree

1 file changed

+54
-32
lines changed

1 file changed

+54
-32
lines changed

.github/workflows/publish-docs.yml

Lines changed: 54 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,71 @@
11
name: Publish Dokka Docs
22

3-
permissions:
4-
actions: write
5-
pages: write
6-
7-
8-
93
on:
104
push:
115
branches:
126
- version/1.21
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
id-token: write
12+
pages: write
1313

1414
jobs:
1515
build:
1616
runs-on: ubuntu-latest
17-
17+
outputs:
18+
artifact: ${{ steps.define-ids.outputs.artifact }}
1819
steps:
19-
- name: Checkout code
20+
- name: Checkout Repository
2021
uses: actions/checkout@v4
21-
22-
- name: Set up JDK
23-
uses: actions/setup-java@v4
2422
with:
25-
distribution: 'graalvm'
26-
java-version: '21'
23+
fetch-depth: 0
2724

28-
- name: Grant execute permission for Gradle
29-
run: chmod +x ./gradlew
25+
- name: Define instance id and artifacts
26+
id: define-ids
27+
run: |
28+
ARTIFACT="dokka-docs.zip"
29+
30+
# Print the values
31+
echo "artifact=$ARTIFACT"
32+
33+
# Set the environment variables and outputs
34+
echo "ARTIFACT=$ARTIFACT" >> $GITHUB_ENV
3035
31-
- name: Install dependencies
32-
run: ./gradlew dependencies
36+
- name: Setup Gradle
37+
uses: gradle/actions/setup-gradle@v3
3338

34-
- name: Generate and move Dokka Docs
35-
run: ./gradlew publishDokkaToDocs
39+
- name: Build docs using Dokka
40+
run: ./gradlew dokkaHtmlMultiModule
3641

37-
- name: Publish
38-
run: ./gradlew publish
39-
env:
40-
MAVEN_USERNAME: ${{ secrets.REPO_PUBLISH_USERNAME }}
41-
MAVEN_PASSWORD: ${{ secrets.REPO_PUBLISH_TOKEN }}
42-
43-
#- name: Commit and Push changes
44-
# run: |
45-
# git config --global user.name "GitHub Actions"
46-
# git config --global user.email "[email protected]"
47-
#git add docs
48-
#git commit -m "Update Dokka Docs"
49-
#git push
42+
- name: Upload docs
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: docs
46+
path: |
47+
build/dokka/htmlMultiModule
48+
49+
deploy:
50+
environment:
51+
name: github-pages
52+
url: ${{ steps.deployment.outputs.page_url }}
53+
needs: [build]
54+
runs-on: ubuntu-latest
55+
steps:
56+
- name: Download docs
57+
uses: actions/download-artifact@v4
58+
with:
59+
name: docs
60+
path: build/dokka/htmlMultiModule
61+
- name: Setup Pages
62+
uses: actions/configure-pages@v4
63+
64+
- name: Package and upload Pages artifact
65+
uses: actions/upload-pages-artifact@v3
66+
with:
67+
path: dir
68+
69+
- name: Deploy to GitHub Pages
70+
id: deployment
71+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)