-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (53 loc) · 1.46 KB
/
typespec-compile-and-deploy-gh-pages.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: typespec-compile-and-deploy-gh-pages
on:
push:
branches:
- main
paths:
- "api/"
- ".github/workflows/typespec-compile-and-deploy-gh-pages.yml"
jobs:
compile:
runs-on: ubuntu-22.04
steps:
- name: checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install typespec
run: npm install -g @typespec/compiler
- name: Cache npm modules
uses: actions/cache@v4
with:
path: api/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('api/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install node_modules
run: cd api && npm ci
- name: Compile typespec
run: tsp compile api
- name: Generate Swagger UI
uses: Legion2/swagger-ui-action@v1
with:
output: swagger-ui
spec-file: api/tsp-output/@typespec/openapi3/openapi.yaml
- name: Upload Swagger UI
uses: actions/upload-pages-artifact@v3
with:
path: swagger-ui
deploy-github-pages:
needs: compile
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-22.04
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3