-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython-generate-and-publish-client-libraries.yml
More file actions
108 lines (100 loc) · 3.88 KB
/
python-generate-and-publish-client-libraries.yml
File metadata and controls
108 lines (100 loc) · 3.88 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Build and Publish Client Libraries
on:
workflow_call:
inputs:
dependency-hash-version:
required: false
type: string
default: "v1"
private-package-repo-url:
description: The url of the private package repository you want to add to poetry. You must also specify `private-package-repo-username`
type: string
required: false
default: ""
extras:
description: Extras to include when installing this package
type: string
required: false
default: NOT_SPECIFIED
expected-python-client-package-name:
description: What you expect the name of the python client package to be
type: string
required: true
cli-name:
description: The name of the CLI for this project
type: string
required: true
python-generator-version:
description: The version of openapi-python-client to use to build the python client library
type: string
required: false
default: "0.13.2"
angular-generator-version:
description: The version of OpenAPITools Generator to use to build the angular client library
type: string
required: false
default: "5.1.1"
python-version:
description: The version of python to install/use
type: string
required: false
default: "3.8"
secrets:
private-package-repo-username:
required: false
private-package-repo-password:
required: false
private-package-repo-push-token:
required: true
jobs:
build-python-client:
name: Python Client Library
runs-on: ubuntu-latest
steps:
- name: Generate OpenAPI Document
uses: triaxtec/github-actions/python/generate-openapi-doc@v3
with:
python-version: ${{ inputs.python-version }}
private-package-repo-url: ${{ inputs.private-package-repo-url }}
private-package-repo-username: ${{ secrets.private-package-repo-username }}
cli-name: ${{ inputs.cli-name }}
dependency-hash-version: ${{ inputs.dependency-hash-version }}
- name: Generate Python Client
run: pipx run --spec openapi-python-client==${{ inputs.python-generator-version }} openapi-python-client generate --config python-generator-config.yml --path openapi.json
- name: Publish Python Client
uses: triaxtec/github-actions/python/publish-package@v3
with:
token: ${{ secrets.private-package-repo-push-token }}
private-package-repo-url: ${{ inputs.private-package-repo-url }}
dir: ./${{ inputs.expected-python-client-package-name }}
build-and-publish-angular-client:
name: Angular Client Library
runs-on: ubuntu-latest
steps:
- name: Generate OpenAPI Document
uses: triaxtec/github-actions/python/generate-openapi-doc@v3
with:
python-version: ${{ inputs.python-version }}
private-package-repo-url: ${{ inputs.private-package-repo-url }}
private-package-repo-username: ${{ secrets.private-package-repo-username }}
cli-name: ${{ inputs.cli-name }}
dependency-hash-version: ${{ inputs.dependency-hash-version }}
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: '14'
- name: Generate Angular Client Library
uses: openapi-generators/openapitools-generator-action@v1.1.1
with:
generator: typescript-angular
config-file: angular-generator-config.yml
generator-tag: v${{ inputs.angular-generator-version }}
- name: Publish Angular Client Library
run: |
cd typescript-angular-client
echo "//npm.fury.io/triaxtec/:_authToken=${{ secrets.private-package-repo-push-token }}" > .npmrc
npm install
npm remove @types/node
npm add -D @types/node@12.20.20
npm run build
npm publish dist