-
Notifications
You must be signed in to change notification settings - Fork 4
82 lines (69 loc) · 2.38 KB
/
openapi.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Generate OpenAPI
on:
release:
types: [published]
jobs:
openapi:
runs-on: ubuntu-latest
env:
DEBUG: True
RUN_MODE: production
SECRET_KEY: changeme!
ALLOWED_HOSTS: localhost,127.0.0.1
DATABASE_URL: sqlite:////tmp/db.sqlite3
CORS_ORIGIN_WHITELIST: "http://localhost,http://127.0.0.1"
CSRF_TRUSTED_ORIGINS: "http://localhost"
REGISTER_VERIFICATION_URL: "http://localhost:4200/verify-user/"
RESET_PASSWORD_VERIFICATION_URL: "http://localhost:4200/reset-password/"
REGISTER_EMAIL_VERIFICATION_URL: "http://localhost:4200/verify-email/"
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/base.txt
- name: Generate OpenAPI
run: python manage.py spectacular --file schema.yml
working-directory: snypy
- name: Upload to release
uses: JasonEtco/upload-to-release@master
with:
args: ./snypy/schema.yml text/yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get release version
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org'
- name: Verify Docker installation
run: |
docker --version
docker pull openapitools/openapi-generator-cli
- name: Generate TypeScript Client
run: |
docker run -u $(id -u):$(id -g) --rm -v "${PWD}:/local" openapitools/openapi-generator-cli generate \
-i https://github.com/snypy/snypy-backend/releases/download/${{ steps.get_version.outputs.VERSION }}/schema.yml \
-g typescript-angular \
-o /local/client \
--additional-properties=npmName=@snypy/rest-client,npmVersion=${{ steps.get_version.outputs.VERSION }},useSingleRequestParameter=true
- name: Build TypeScript Client
run: |
cd client
npm install --force
npm run build
- name: Publish to NPM
run: |
cd client/dist
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}