Skip to content

Commit 224f7de

Browse files
bors[bot]Bromeon
andauthored
Merge #1047
1047: CI workflow to notify API Docs automation (gdnative) r=Bromeon a=Bromeon Equivalent of godot-rust/gdext#259. Co-authored-by: Jan Haller <bromeon@gmail.com>
2 parents 3805ea6 + 18ae4b4 commit 224f7de

File tree

5 files changed

+107
-126
lines changed

5 files changed

+107
-126
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
MTFBQUZNN0NBMFNDMDRLWUQxNU5Oel9wazJ1Z3R4Q2U4alA4bFFIMHlzOU9raDNhZFZHTk44VUVlQ0F4Y3ZBeGIzV1BKSzNQN1FJOFlUdmQ4UQo=

.github/workflows/doc.yml

Lines changed: 0 additions & 118 deletions
This file was deleted.

.github/workflows/doc/index.html

Lines changed: 0 additions & 7 deletions
This file was deleted.

.github/workflows/update-docs.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# This Source Code Form is subject to the terms of the Mozilla Public
2+
# License, v. 2.0. If a copy of the MPL was not distributed with this
3+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
4+
5+
name: Compile + Sync Docs
6+
7+
on:
8+
pull_request:
9+
types:
10+
- opened
11+
- reopened
12+
- closed
13+
- synchronize
14+
15+
push:
16+
branches:
17+
- master
18+
19+
20+
jobs:
21+
notify-docs:
22+
runs-on: ubuntu-latest
23+
steps:
24+
# Checkout is always needed, for the notify step
25+
- name: "Checkout"
26+
uses: actions/checkout@v3
27+
28+
# This is just a sanity check to make sure that the follow-up docs generation doesn't break.
29+
# So we use the Rust version provided by the GitHub runners, which hopefully is >= MSRV.
30+
- name: "Compile"
31+
if: github.event_name == 'pull_request' && github.event.action != 'closed'
32+
run: cargo check -p gdnative --features async,serde,inventory
33+
34+
# Pushed to master: no PR-related information
35+
- name: "Construct JSON (for master)"
36+
if: github.ref == 'refs/heads/master'
37+
run: |
38+
payload=$(cat <<'HEREDOC'
39+
{
40+
"op": "put",
41+
"repo": "gdnative",
42+
"num": "master",
43+
"commit-sha": "${{ github.sha }}",
44+
"date": "${{ github.event.head_commit.timestamp }}"
45+
}
46+
HEREDOC)
47+
echo "VAR=$payload"
48+
echo "GDNATIVE_JSON<<HEREDOC" >> $GITHUB_ENV
49+
echo "${payload}" >> $GITHUB_ENV
50+
echo "HEREDOC" >> $GITHUB_ENV
51+
52+
# Opened/reopened/updated PR: include PR author + title
53+
- name: "Construct JSON (for PR sync)"
54+
if: github.event_name == 'pull_request' && github.event.action != 'closed'
55+
run: |
56+
payload=$(cat <<'HEREDOC'
57+
{
58+
"op": "put",
59+
"repo": "gdnative",
60+
"num": "${{ github.event.number }}",
61+
"commit-sha": "${{ github.event.pull_request.head.sha }}",
62+
"date": "${{ github.event.pull_request.updated_at }}",
63+
"pr-author": "${{ github.event.pull_request.user.login }}",
64+
"pr-title": "${{ github.event.pull_request.title }}"
65+
}
66+
HEREDOC)
67+
echo "VAR=$payload"
68+
echo "GDNATIVE_JSON<<HEREDOC" >> $GITHUB_ENV
69+
echo "${payload}" >> $GITHUB_ENV
70+
echo "HEREDOC" >> $GITHUB_ENV
71+
72+
# Closed/merged PR: no more PR-related information necessary, as it will be removed
73+
- name: "Construct JSON (for closed PR)"
74+
if: github.event_name == 'pull_request' && github.event.action == 'closed'
75+
run: |
76+
payload=$(cat <<'HEREDOC'
77+
{
78+
"op": "delete",
79+
"repo": "gdnative",
80+
"num": "${{ github.event.number }}",
81+
"date": "${{ github.event.pull_request.updated_at }}"
82+
}
83+
HEREDOC)
84+
echo "VAR=$payload"
85+
echo "GDNATIVE_JSON<<HEREDOC" >> $GITHUB_ENV
86+
echo "${payload}" >> $GITHUB_ENV
87+
echo "HEREDOC" >> $GITHUB_ENV
88+
89+
- name: "Print payload"
90+
run: |
91+
echo "$GDNATIVE_JSON"
92+
93+
- name: "Prepare request"
94+
run: |
95+
token=$(cat .github/external-config/public-docs-token.txt | base64 -w0 -d)
96+
echo "DOCS_GENERATOR_TOKEN=github_pat_$token" >> $GITHUB_ENV
97+
98+
- name: "Notify doc workflow"
99+
uses: peter-evans/repository-dispatch@v2
100+
with:
101+
token: ${{ env.DOCS_GENERATOR_TOKEN }}
102+
repository: godot-rust/dispatch-forwarder
103+
event-type: 'Generate docs'
104+
client-payload: ${{ env.GDNATIVE_JSON }}
105+

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
**godot-rust** is a Rust library that implements native bindings for the [Godot game engine](http://godotengine.org/). This allows you to develop games or other applications in Godot, while benefiting from Rust's strengths, such as its type system, scalability and performance.
1212

13-
> **Note**: if you are looking for a Rust binding for GDExtension (Godot 4), checkout [`gdextension`](https://github.com/godot-rust/gdextension).
13+
> **Note**: if you are looking for a Rust binding for GDExtension (Godot 4), checkout [`gdext`](https://github.com/godot-rust/gdext).
1414
1515

1616
## Stability

0 commit comments

Comments
 (0)