Update Go SDK Version to 2.1.19 #40
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Update Go SDK Version" | |
run-name: Update Go SDK Version to ${{ github.event.inputs.version }} | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: The version to bump to | |
jobs: | |
update_go_version: | |
name: Update Go 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 Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "16" | |
# 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`) | |
LATEST_TAG="${LATEST_TAG: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 | |
- name: Update configuration.go user agent version | |
id: updateUserAgentVersion | |
if: steps.updateVersion.outcome == 'success' | |
run: | | |
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) | |
sed -e "s/${LATEST_TAG:1}/${{ github.event.inputs.version }}/g" configuration.go > configuration.go.tmp && mv configuration.go.tmp configuration.go | |
- name: Download OpenAPI Generator | |
run: | | |
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.11.0/openapi-generator-cli-7.11.0.jar -O openapi-generator-cli.jar | |
- name: Run Prescript | |
id: prescript | |
run: | | |
node sdk-resources/prescript.js api-specs/ | |
- name: Build V3 SDK | |
id: buildV3 | |
if: steps.updateUserAgentVersion.outcome == 'success' | |
run: | | |
rm -rf ./api_v3 | |
java -jar openapi-generator-cli.jar generate -i api-specs/idn/sailpoint-api.v3.yaml -g go -o api_v3 --global-property skipFormModel=false --config sdk-resources/v3-config.yaml | |
node sdk-resources/postscript.js ./api_v3 | |
- name: Build Beta SDK | |
id: buildBeta | |
if: steps.buildV3.outcome == 'success' | |
run: | | |
rm -rf ./api_beta | |
java -jar openapi-generator-cli.jar generate -i api-specs/idn/sailpoint-api.beta.yaml -g go -o api_beta --global-property skipFormModel=false --config sdk-resources/beta-config.yaml | |
node sdk-resources/postscript.js ./api_beta | |
- name: Build V2024 SDK | |
id: buildV2024 | |
if: steps.buildBeta.outcome == 'success' | |
run: | | |
rm -rf ./api_v2024 | |
java -jar openapi-generator-cli.jar generate -i api-specs/idn/sailpoint-api.v2024.yaml -g go -o api_v2024 --global-property skipFormModel=false --config sdk-resources/v2024-config.yaml | |
node sdk-resources/postscript.js ./api_v2024 | |
- name: After SDK Build | |
id: buildSDK | |
if: steps.buildV2024.outcome == 'success' | |
run: | | |
go get -d ./... | |
go install | |
- 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 v${{ 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 |