Skip to content

Commit acf504f

Browse files
committed
Add github action to publish java doc
1 parent 3f8966e commit acf504f

File tree

2 files changed

+140
-1
lines changed

2 files changed

+140
-1
lines changed
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
name: Publish Javadoc
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
pages: write
12+
id-token: write
13+
14+
jobs:
15+
publish-javadoc:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Set up JDK 17
23+
uses: actions/setup-java@v4
24+
with:
25+
distribution: 'temurin'
26+
java-version: '17'
27+
cache: 'gradle'
28+
29+
- name: Setup Android SDK
30+
uses: android-actions/setup-android@v3
31+
32+
- name: Grant execute permission for gradlew
33+
run: chmod +x gradlew
34+
35+
- name: Generate Auth Javadoc
36+
run: ./gradlew auth-lib:authReleaseJavadoc
37+
38+
- name: Generate Store Javadoc
39+
run: ./gradlew auth-lib:storeReleaseJavadoc
40+
41+
- name: Prepare gh-pages directory structure
42+
run: |
43+
mkdir -p gh-pages-temp/auth-lib/docs
44+
mkdir -p gh-pages-temp/auth-lib/docs-store
45+
cp -r docs/* gh-pages-temp/auth-lib/docs/ || echo "Auth docs generated"
46+
cp -r docs-store/* gh-pages-temp/auth-lib/docs-store/ || echo "Store docs generated"
47+
48+
- name: Create index page
49+
run: |
50+
cat > gh-pages-temp/index.html << 'EOF'
51+
<!DOCTYPE html>
52+
<html>
53+
<head>
54+
<title>Spotify Android Auth SDK Documentation</title>
55+
<meta charset="UTF-8">
56+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
57+
<style>
58+
body {
59+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
60+
max-width: 800px;
61+
margin: 50px auto;
62+
padding: 20px;
63+
line-height: 1.6;
64+
}
65+
h1 {
66+
color: #1DB954;
67+
border-bottom: 2px solid #1DB954;
68+
padding-bottom: 10px;
69+
}
70+
.flavor {
71+
margin: 20px 0;
72+
padding: 20px;
73+
border: 1px solid #ddd;
74+
border-radius: 8px;
75+
background-color: #f9f9f9;
76+
}
77+
.flavor h2 {
78+
margin-top: 0;
79+
color: #333;
80+
}
81+
.flavor p {
82+
color: #666;
83+
margin: 10px 0;
84+
}
85+
a {
86+
color: #1DB954;
87+
text-decoration: none;
88+
font-weight: 500;
89+
}
90+
a:hover {
91+
text-decoration: underline;
92+
}
93+
.footer {
94+
margin-top: 40px;
95+
padding-top: 20px;
96+
border-top: 1px solid #ddd;
97+
text-align: center;
98+
color: #999;
99+
font-size: 0.9em;
100+
}
101+
</style>
102+
</head>
103+
<body>
104+
<h1>Spotify Android Auth SDK Documentation</h1>
105+
106+
<div class="flavor">
107+
<h2>Auth Flavor</h2>
108+
<p>Standard authentication flavor - opens web browser for login</p>
109+
<a href="auth-lib/docs/index.html">View Auth Javadoc →</a>
110+
</div>
111+
112+
<div class="flavor">
113+
<h2>Store Flavor</h2>
114+
<p>Play Store fallback flavor - redirects to Play Store if Spotify app unavailable</p>
115+
<a href="auth-lib/docs-store/index.html">View Store Javadoc →</a>
116+
</div>
117+
118+
<div class="footer">
119+
<p>Generated from <a href="https://github.com/spotify/android-auth">spotify/android-auth</a></p>
120+
</div>
121+
</body>
122+
</html>
123+
EOF
124+
125+
- name: Deploy to GitHub Pages
126+
uses: peaceiris/actions-gh-pages@v3
127+
with:
128+
github_token: ${{ secrets.GITHUB_TOKEN }}
129+
publish_dir: ./gh-pages-temp
130+
publish_branch: gh-pages
131+
user_name: 'github-actions[bot]'
132+
user_email: 'github-actions[bot]@users.noreply.github.com'
133+
commit_message: 'Update javadoc from ${{ github.sha }}'

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ If you want to retain the previous behavior (accepting any path), use .* as the
5151
For more details, see the [Google documentation](https://developer.android.com/guide/topics/manifest/data-element#path).
5252

5353
To learn more see the [Authentication Guide](https://developer.spotify.com/technologies/spotify-android-sdk/android-sdk-authentication-guide/)
54-
and the [API reference](https://spotify.github.io/android-sdk/auth-lib/docs/index.html).
54+
and the [API reference](https://spotify.github.io/android-auth/auth-lib/docs/index.html).
5555

5656
# Flavors
5757

@@ -60,6 +60,12 @@ their behaviour if the Spotify application cannot be used to login:
6060
* `auth` - Opens the web browser to login to Spotify
6161
* `store` - Redirects to the Android Play store to download the Spotify application
6262

63+
# Documentation
64+
65+
Complete API documentation is available for both library flavors:
66+
* [Auth Flavor Javadoc](https://spotify.github.io/android-auth/auth-lib/docs/index.html) - Opens web browser for login
67+
* [Store Flavor Javadoc](https://spotify.github.io/android-auth/auth-lib/docs-store/index.html) - Play Store fallback variant
68+
6369
# Sample Code
6470

6571
Checkout [the sample project](auth-sample).

0 commit comments

Comments
 (0)