-
Notifications
You must be signed in to change notification settings - Fork 2
144 lines (118 loc) · 5.01 KB
/
bump_version.yaml
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: "Update Python SDK Version"
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 }}
run-name: Update Python SDK Version to ${{ github.event.inputs.version }}
on:
workflow_dispatch:
inputs:
version:
description: The version to bump to
jobs:
update_python_version:
name: Update Python Version
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
fetch-depth: 0
token: ${{ secrets.DEVREL_SERVICE_TOKEN }}
- name: Checkout API Specs Repo
uses: actions/checkout@v3
with:
repository: sailpoint-oss/api-specs
path: api-specs
ref: main
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: "16"
- name: Run Prescript
id: prescript
run: |
node sdk-resources/prescript.js api-specs/idn
# Install yq for working with yaml files
- name: Set up yq
uses: frenck/action-setup-yq@v1
# Check input version is greater than the current tag
- name: Check valid version
run: |
function ver { printf "%03d%03d%03d%03d" $(echo "$1" | tr '.' ' '); }
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
echo $LATEST_TAG
if [ $(ver $LATEST_TAG) -lt $(ver ${{ github.event.inputs.version}}) ]
then
echo "Input version ${{ github.event.inputs.version }} valid"
else
echo "Current tagged version $LATEST_TAG is greater than input version ${{ github.event.inputs.version }}"
exit 1
fi
## Update configuration files to new version
- name: Update config files with new version
id: updateVersion
run: |
yq -i '.packageVersion = "${{ github.event.inputs.version }}"' sdk-resources/beta-config.yaml
yq -i '.packageVersion = "${{ github.event.inputs.version }}"' sdk-resources/v3-config.yaml
yq -i '.packageVersion = "${{ github.event.inputs.version }}"' sdk-resources/v2024-config.yaml
## Update setup.py file with new version
- name: Update setup.py package
id: updatePackageVersion
if: steps.updateVersion.outcome == 'success'
run: |
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
sed -e "s/VERSION = \"${LATEST_TAG:1}\"/VERSION = \"${{ github.event.inputs.version }}\"/g" setup.py > setup.py.tmp && mv setup.py.tmp setup.py
- name: Build V3 SDK
id: buildV3
if: steps.updatePackageVersion.outcome == 'success'
run: |
rm -rf ./sailpoint/v3
java -jar openapi-generator-cli.jar generate -i api-specs/idn/sailpoint-api.v3.yaml -g python -o . --global-property skipFormModel=false --config sdk-resources/v3-config.yaml --enable-post-process-file
- name: Build Beta SDK
id: buildBeta
if: steps.buildV3.outcome == 'success'
run: |
rm -rf ./sailpoint/beta
java -jar openapi-generator-cli.jar generate -i api-specs/idn/sailpoint-api.beta.yaml -g python -o . --global-property skipFormModel=false --config sdk-resources/beta-config.yaml --enable-post-process-file
node sdk-resources/postscript.js ./sailpoint/beta
- name: Build V2024 SDK
id: buildV2024
if: steps.buildBeta.outcome == 'success'
run: |
rm -rf ./sailpoint/v2024
java -jar openapi-generator-cli.jar generate -i api-specs/idn/sailpoint-api.v2024.yaml -g python -o . --global-property skipFormModel=false --config sdk-resources/v2024-config.yaml --enable-post-process-file
node sdk-resources/postscript.js ./sailpoint/v2024
- name: After SDK Build
id: buildSDK
if: steps.buildV2024.outcome == 'success'
shell: pwsh
run: |
pip install -r requirements.txt
pip install -e .
python validation_test.py -v
- name: Commit changes and create new version tag
if: steps.buildSDK.outcome == 'success'
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Bump version to ${{ github.event.inputs.version }}
tagging_message: v${{ github.event.inputs.version }}
commit_user_name: developer-relations-sp
commit_user_email: [email protected]
- name: Create Draft Release
id: createRelease
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.event.inputs.version }}
release_name: v${{ github.event.inputs.version }}
draft: false
prerelease: false