Skip to content

Commit d6b89bc

Browse files
authored
Publish wp_api docs to GitHub Pages (#749)
1 parent bfb6f0a commit d6b89bc

File tree

5 files changed

+55
-6
lines changed

5 files changed

+55
-6
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- trunk
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
jobs:
14+
build:
15+
name: Build
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
- name: Setup Rust
22+
uses: dtolnay/rust-toolchain@stable
23+
- name: Configure cache
24+
uses: Swatinem/rust-cache@v2
25+
- name: Setup pages
26+
id: pages
27+
uses: actions/configure-pages@v5
28+
- name: Clean docs folder
29+
run: cargo clean --doc
30+
- name: Build docs
31+
run: cargo doc -p wp_api --no-deps
32+
- name: Add redirect
33+
run: echo '<meta http-equiv="refresh" content="0;url=wp_api/index.html">' > target/doc/index.html
34+
- name: Remove lock file
35+
run: rm target/doc/.lock
36+
- name: Upload artifact
37+
uses: actions/upload-pages-artifact@v3
38+
with:
39+
path: target/doc
40+
deploy:
41+
name: Deploy
42+
environment:
43+
name: github-pages
44+
url: ${{ steps.deployment.outputs.page_url }}
45+
runs-on: ubuntu-latest
46+
needs: build
47+
steps:
48+
- name: Deploy to GitHub Pages
49+
id: deployment
50+
uses: actions/deploy-pages@v4

wp_api/src/login.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl WpApiDetails {
9595
/// Returns the URL to be used in application password authentication.
9696
///
9797
/// See the "Authorization Flow" section for details:
98-
/// https://github.com/WordPress/wordpress-develop/blob/530493396b324f5bed518a494e2843e7fdb020f1/src/wp-includes/rest-api.php#L1099-L1119
98+
/// <https://github.com/WordPress/wordpress-develop/blob/530493396b324f5bed518a494e2843e7fdb020f1/src/wp-includes/rest-api.php#L1099-L1119>
9999
pub fn find_application_passwords_authentication_url(&self) -> Option<String> {
100100
self.authentication
101101
.find_application_passwords_authentication_url()
@@ -267,7 +267,7 @@ impl WpApiDetailsAuthenticationMap {
267267
/// Return a URL to be used in application password authentication.
268268
///
269269
/// See the "Authorization Flow" section for details:
270-
/// https://make.wordpress.org/core/2020/11/05/application-passwords-integration-guide/
270+
/// <https://make.wordpress.org/core/2020/11/05/application-passwords-integration-guide/>
271271
#[uniffi::export]
272272
pub fn create_application_password_authentication_url(
273273
login_url: Arc<ParsedUrl>,

wp_api/src/login/url_discovery.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ pub struct RootWpJson {
253253

254254
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
255255
pub struct ParseHomepageResult {
256-
/// `href` attribute of a link tag if it has `rel` attribute of "https://api.w.org/".
256+
/// `href` attribute of a link tag if it has `rel` attribute of "<https://api.w.org/>".
257257
/// For example:
258258
/// <link href="http://localhost/wp-json/" rel="https://api.w.org/">
259259
pub api_root_url_from_link_tag: Option<Arc<ParsedUrl>>,

wp_api/src/request.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -647,8 +647,7 @@ impl WpSupportsLocalization for HttpAuthMethodParsingError {
647647
}
648648
}
649649

650-
/// Parser based on https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/WWW-Authenticate
651-
///
650+
/// Parser based on <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/WWW-Authenticate>
652651
impl FromStr for HttpAuthMethod {
653652
type Err = HttpAuthMethodParsingError;
654653

wp_api/src/wordpress_org/plugin_directory.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ pub struct Ratings {
8484
pub one_star: u32,
8585
}
8686

87-
/// https://developer.wordpress.org/plugins/wordpress-org/plugin-assets/#screenshots
87+
/// <https://developer.wordpress.org/plugins/wordpress-org/plugin-assets/#screenshots>
8888
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, uniffi::Enum)]
8989
#[serde(untagged)]
9090
pub enum Screenshots {

0 commit comments

Comments
 (0)