🚀 Make OpenAPI definition available (#3542)
* 🚀 Make OpenAPI definition available Signed-off-by: Alexandre Franke <alexandre.franke@matrix.org> * 💚 Fix artifact name Signed-off-by: Alexandre Franke <alexandre.franke@matrix.org> * 💚 Introduce dependency between jobs Signed-off-by: Alexandre Franke <alexandre.franke@matrix.org> * 🚀 Make historical definitions available Signed-off-by: Alexandre Franke <alexandre.franke@matrix.org> Co-authored-by: Alexandre Franke <alexandre.franke@matrix.org>
This commit is contained in:
parent
87822fa105
commit
806ae22da7
2 changed files with 27 additions and 1 deletions
26
.github/workflows/main.yml
vendored
26
.github/workflows/main.yml
vendored
|
@ -60,6 +60,7 @@ jobs:
|
|||
build-spec:
|
||||
name: "📖 Build the spec"
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-openapi]
|
||||
steps:
|
||||
- name: "➕ Setup Node"
|
||||
uses: actions/setup-node@v2
|
||||
|
@ -97,6 +98,20 @@ jobs:
|
|||
|
||||
- name: "⚙️ hugo"
|
||||
run: hugo --baseURL "${{ steps.set-baseurl.outputs.baseURL }}" -d "spec"
|
||||
|
||||
# We manually copy the spec OpenAPI definition JSON to the website tree
|
||||
# to make it available to the world in a canonical place:
|
||||
# https://spec.matrix.org/latest/client-server-api/api.json
|
||||
# Works for /unstable/ and /v1.1/ as well.
|
||||
- name: "📥 Spec definition download"
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: openapi-artifact
|
||||
- name: "📝 Copy the definition to the right location"
|
||||
run: |
|
||||
tar -xzf assets.tar.gz
|
||||
cp assets/spec/client_server/api.json spec/client-server-api/
|
||||
|
||||
- name: "📦 Tarball creation"
|
||||
run: tar -czf spec.tar.gz spec
|
||||
- name: "📤 Artifact upload"
|
||||
|
@ -132,6 +147,17 @@ jobs:
|
|||
run: |
|
||||
echo -e '[params.version]\nstatus="historical"' > historical.toml
|
||||
hugo --config config.toml,historical.toml --baseURL "/${GITHUB_REF/refs\/tags\//}" -d "spec"
|
||||
|
||||
# Copying the spec definition to the tree
|
||||
- name: "📥 Spec definition download"
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: openapi-artifact
|
||||
- name: "📝 Copy the definition to the right location"
|
||||
run: |
|
||||
tar -xzf assets.tar.gz
|
||||
cp assets/spec/client_server/api.json spec/client-server-api/
|
||||
|
||||
- name: "📦 Tarball creation"
|
||||
run: tar -czf spec-historical.tar.gz spec
|
||||
- name: "📤 Artifact upload"
|
||||
|
|
|
@ -9,7 +9,7 @@ cd `dirname $0`/..
|
|||
mkdir -p assets
|
||||
|
||||
# and the swagger
|
||||
./scripts/dump-swagger.py -o assets/spec/client_server/unstable.json
|
||||
./scripts/dump-swagger.py -o assets/spec/client_server/api.json
|
||||
|
||||
# create a tarball of the assets.
|
||||
tar -czf assets.tar.gz assets
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue