From 806ae22da7e8bcd919e6beec93ea6529fac76c38 Mon Sep 17 00:00:00 2001 From: Alexandre Franke Date: Thu, 9 Dec 2021 03:28:08 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20Make=20OpenAPI=20definition=20av?= =?UTF-8?q?ailable=20(#3542)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🚀 Make OpenAPI definition available Signed-off-by: Alexandre Franke * 💚 Fix artifact name Signed-off-by: Alexandre Franke * 💚 Introduce dependency between jobs Signed-off-by: Alexandre Franke * 🚀 Make historical definitions available Signed-off-by: Alexandre Franke Co-authored-by: Alexandre Franke --- .github/workflows/main.yml | 26 ++++++++++++++++++++++++++ scripts/generate-matrix-org-assets | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 76d0d9e6..a8dfff33 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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" diff --git a/scripts/generate-matrix-org-assets b/scripts/generate-matrix-org-assets index 6b9881d1..ea33b9ff 100755 --- a/scripts/generate-matrix-org-assets +++ b/scripts/generate-matrix-org-assets @@ -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