-
Notifications
You must be signed in to change notification settings - Fork 18
104 lines (86 loc) · 3.5 KB
/
build-go-sdk.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: "Build and push go sdk"
env:
SAIL_CLIENT_ID: ${{ secrets.SDK_TEST_TENANT_CLIENT_ID }}
SAIL_CLIENT_SECRET: ${{ secrets.SDK_TEST_TENANT_CLIENT_SECRET }}
SAIL_BASE_URL: ${{ secrets.SDK_TEST_TENANT_BASE_URL }}
on:
push:
branches:
- main
paths:
- idn/**
workflow_dispatch:
jobs:
push_spec_workflow:
name: Build and push Go SDK
runs-on: ubuntu-latest
steps:
# Checkout the master branch request to run rsync
- name: Checkout PR branch
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
# Checkout the main branch of api-specs
- name: Checkout API Specs Repo
uses: actions/checkout@v2
with:
repository: sailpoint-oss/golang-sdk
path: golang-sdk
ref: main
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: "16"
- name: Run Prescript
id: prescript
run: |
cd golang-sdk
node sdk-resources/prescript.js ../idn/
- name: Build V3 SDK
id: buildV3
if: steps.prescript.outcome == 'success'
run: |
cd golang-sdk
rm -rf ./v3
java -jar openapi-generator-cli.jar generate -i ../idn/sailpoint-api.v3.yaml -g go -o v3 --global-property skipFormModel=false --config sdk-resources/v3-config.yaml -p enumClassPrefix=true --git-repo-id golang-sdk --git-user-id sailpoint-oss
node sdk-resources/postscript.js ./v3
- name: Build Beta SDK
id: buildBeta
if: steps.buildV3.outcome == 'success'
run: |
cd golang-sdk
rm -rf ./beta
java -jar openapi-generator-cli.jar generate -i ../idn/sailpoint-api.beta.yaml -g go -o beta --global-property skipFormModel=false --config sdk-resources/beta-config.yaml -p enumClassPrefix=true --git-repo-id golang-sdk --git-user-id sailpoint-oss
node sdk-resources/postscript.js ./beta
- name: Build V2 SDK
id: buildV2
if: steps.buildBeta.outcome == 'success'
run: |
cd golang-sdk
rm -rf ./v2
java -jar openapi-generator-cli.jar generate -i ../idn/sailpoint-api.v2.yaml -g go -o v2 --global-property skipFormModel=false --config sdk-resources/v2-config.yaml -p enumClassPrefix=true --git-repo-id golang-sdk --git-user-id sailpoint-oss
node sdk-resources/postscript.js ./v2
- name: Build CC SDK
id: buildCC
if: steps.buildV2.outcome == 'success'
run: |
cd golang-sdk
rm -rf ./cc
java -jar openapi-generator-cli.jar generate -i ../idn/sailpoint-api.cc.yaml -g go -o cc --global-property skipFormModel=false --config sdk-resources/cc-config.yaml -p enumClassPrefix=true --git-repo-id golang-sdk --git-user-id sailpoint-oss
node sdk-resources/postscript.js ./cc
- name: After SDK Build
if: steps.buildCC.outcome == 'success'
run: |
cd golang-sdk/
go get -d ./...
go install
go test
git config --unset-all http.https://github.com/.extraheader
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action Bot"
git add .
git commit -m "Automated build '${{ github.event.head_commit.message }}' go sdk: ${{ github.run_id }}"
git status
git remote set-url origin https://${{secrets.API_SPEC_PAT}}@github.com/sailpoint-oss/golang-sdk.git
git remote -v
git push