Generate & Publish SDK #1078
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: Generate & Publish SDK | |
on: | |
schedule: | |
- cron: '30 10 * * *' | |
workflow_dispatch: | |
jobs: | |
generate: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '14' | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '15' | |
distribution: 'adopt' | |
- name: Cache Maven packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Install OpenAPI Tools | |
run: npm install @openapitools/openapi-generator-cli -g | |
- name: Cleanup folders | |
run: | | |
rm -rf ./src | |
rm -rf ./docs | |
- name: Download OpenAPI Spec | |
run: curl https://api.mydatamyconsent.com/openapi-spec.json --output openapi-spec.json | |
- name: Cleanup Spec | |
run: | | |
sed -i 's/FinancialAccount\[\(.*\)]/FinancialAccount\1/' openapi-spec.json | |
sed -i 's/FinancialAccountTransaction\[\(.*\)]/FinancialAccount\1/' openapi-spec.json | |
sed -i 's/PaginatedList<\(.*\)>/PaginatedListOf\1s/' openapi-spec.json | |
- name: Generate SDK's | |
run: npx @openapitools/openapi-generator-cli generate | |
- name: Repository update | |
uses: EndBug/add-and-commit@v9 | |
with: | |
author_name: Balamurali Pandranki | |
author_email: [email protected] | |
message: 'Generate API SDK' | |
push: true | |
- name: Build with Maven | |
run: mvn -B package --no-transfer-progress --file pom.xml | |
- name: Publish package | |
run: mvn --batch-mode deploy | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |