Skip to content

Merge pull request #73 from ingrammicro-xvantage/feature/tweak-workflow #60

Merge pull request #73 from ingrammicro-xvantage/feature/tweak-workflow

Merge pull request #73 from ingrammicro-xvantage/feature/tweak-workflow #60

Workflow file for this run

name: Generate SDK and Push SDK to its respective repository
on:
push:
branches:
- main
paths:
- openapispec/unified/XI-Resellers-API-Spec.yaml
jobs:
push_to_another_repo:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install OpenAPI Generator
run: |
npm install -g @openapitools/openapi-generator-cli@latest
- name: Generate C# SDK
run: |
openapi-generator-cli generate -i openapispec/unified/XI-Resellers-API-Spec.yaml -g csharp -o ${{ github.workspace }}/csharpsdk --package-name xi.sdk.resellers --library httpclient
- name: Configure Git for C# SDK
run: |
git config --local user.email ${{secrets.ADMIN_EMAIL}}
git config --local user.name ${{secrets.ORG_NAME}}
- name: Clone Destination Repository
uses: actions/checkout@v4
with:
repository: ingrammicro-xvantage/xi-sdk-resellers-csharp
path: destination-repo
- name: Create .github/workflows directory if not exists
run: |
mkdir -p ${{ github.workspace }}/csharpsdk/.github/workflows
- name: Create assets/images directory if not exists
run: |
mkdir -p ${{ github.workspace }}/csharpsdk/assets/images
- name: Copy workflow and Cs.proj files to generated CSharp SDK
run: |
cp -r destination-repo/.github/workflows/* ${{ github.workspace }}/csharpsdk/.github/workflows
cp -r destination-repo/src/xi.sdk.resellers/xi.sdk.resellers.csproj ${{ github.workspace }}/csharpsdk/src/xi.sdk.resellers/
cp -r destination-repo/src/xi.sdk.resellers.Test/xi.sdk.resellers.Test.csproj ${{ github.workspace }}/csharpsdk/src/xi.sdk.resellers.Test/
cp -r destination-repo/LICENCE ${{ github.workspace }}/csharpsdk/
cp -r destination-repo/getting-started.md ${{ github.workspace }}/csharpsdk/
cp -r destination-repo/assets/images* ${{ github.workspace }}/csharpsdk/assets/images
- name: Push C# SDK to Another Repository
uses: cpina/github-action-push-to-another-repository@main
env:
API_TOKEN_GITHUB: ${{ secrets.WORKFLOW_TOKEN }}
with:
source-directory: 'csharpsdk'
destination-github-username: ${{secrets.ORG_NAME}}
destination-repository-name: 'xi-sdk-resellers-csharp'
user-email: ${{secrets.ADMIN_EMAIL}}
target-branch: 'feature'
create-target-branch-if-needed: true
- name: Generate Python SDK
run: |
openapi-generator-cli generate --verbose -i openapispec/unified/XI-Resellers-API-Spec.yaml -g python -o ${{ github.workspace }}/pythonsdk --package-name xi.sdk.resellers
- name: Configure Git for Python SDK
run: |
git config --local user.email ${{secrets.ADMIN_EMAIL}}
git config --local user.name ${{secrets.ORG_NAME}}
- name: Clone Destination Repository
uses: actions/checkout@v4
with:
repository: ingrammicro-xvantage/xi-sdk-resellers-python
path: destination-repo
- name: Create assets/images directory if not exists
run: |
mkdir -p ${{ github.workspace }}/pythonsdk/assets/images
- name: Copy worflow and setup.py files to generated Python SDK
run: |
cp -r destination-repo/.github/workflows/* ${{ github.workspace }}/pythonsdk/.github/workflows
cp -r destination-repo/setup.py ${{ github.workspace }}/pythonsdk/
cp -r destination-repo/LICENCE ${{ github.workspace }}/pythonsdk/
cp -r destination-repo/assets/images* ${{ github.workspace }}/pythonsdk/assets/images
cp -r destination-repo/getting-started.md ${{ github.workspace }}/pythonsdk/
- name: Push Python SDK to Another Repository
uses: cpina/github-action-push-to-another-repository@main
env:
API_TOKEN_GITHUB: ${{ secrets.WORKFLOW_TOKEN }}
with:
source-directory: 'pythonsdk'
destination-github-username: ${{secrets.ORG_NAME}}
destination-repository-name: 'xi-sdk-resellers-python'
user-email: ${{secrets.ADMIN_EMAIL}}
target-branch: 'feature'
create-target-branch-if-needed: true
- name: Generate Node.Js SDK
run: |
openapi-generator-cli generate --verbose -i openapispec/unified/XI-Resellers-API-Spec.yaml -g javascript -o ${{ github.workspace }}/javascriptsdk --package-name xi.sdk.resellers
- name: Configure Git for Node.Js SDK
run: |
git config --local user.email ${{secrets.ADMIN_EMAIL}}
git config --local user.name ${{secrets.ORG_NAME}}
- name: Clone Destination Repository
uses: actions/checkout@v4
with:
repository: ingrammicro-xvantage/xi-sdk-resellers-node
path: destination-repo
- name: Create .github/workflows directory if not exists
run: |
mkdir -p ${{ github.workspace }}/javascriptsdk/.github/workflows
- name: Create assets/images directory if not exists
run: |
mkdir -p ${{ github.workspace }}/javascriptsdk/assets/images
- name: Copy workflow and package.json files to generated Javascript SDK
run: |
cp -r destination-repo/.github/workflows/* ${{ github.workspace }}/javascriptsdk/.github/workflows
cp -r destination-repo/package.json ${{ github.workspace }}/javascriptsdk/
cp -r destination-repo/LICENCE ${{ github.workspace }}/javascriptsdk/
cp -r destination-repo/assets/images* ${{ github.workspace }}/javascriptsdk/assets/images
cp -r destination-repo/getting-started.md ${{ github.workspace }}/javascriptsdk/
- name: Push Node.Js SDK to Another Repository
uses: cpina/github-action-push-to-another-repository@main
env:
API_TOKEN_GITHUB: ${{ secrets.WORKFLOW_TOKEN }}
with:
source-directory: 'javascriptsdk'
destination-github-username: ${{secrets.ORG_NAME}}
destination-repository-name: 'xi-sdk-resellers-node'
user-email: ${{secrets.ADMIN_EMAIL}}
target-branch: 'feature'
create-target-branch-if-needed: true
- name: Generate Java SDK
run: |
openapi-generator-cli generate --verbose -i openapispec/unified/XI-Resellers-API-Spec.yaml -g java -o ${{ github.workspace }}/javasdk --artifact-id xi.sdk.resellers --group-id xi.sdk.resellers --api-package xiresellers.client.api --model-package xiresellers.client.model
- name: Configure Git for Java SDK
run: |
git config --local user.email ${{secrets.ADMIN_EMAIL}}
git config --local user.name ${{secrets.ORG_NAME}}
- name: Clone Destination Repository
uses: actions/checkout@v4
with:
repository: ingrammicro-xvantage/xi-sdk-resellers-java
path: destination-repo
- name: Create assets/images directory if not exists
run: |
mkdir -p ${{ github.workspace }}/javasdk/assets/images
- name: Copy workflow and pom.xml files to generated Java SDK
run: |
cp -r destination-repo/.github/workflows/* ${{ github.workspace }}/javasdk/.github/workflows
cp -r destination-repo/pom.xml ${{ github.workspace }}/javasdk/
cp -r destination-repo/assets/images* ${{ github.workspace }}/javasdk/assets/images
cp -r destination-repo/getting-started.md ${{ github.workspace }}/javasdk/
cp -r destination-repo/LICENSE ${{ github.workspace }}/javasdk/
- name: Push Java SDK to Another Repository
uses: cpina/github-action-push-to-another-repository@main
env:
API_TOKEN_GITHUB: ${{ secrets.WORKFLOW_TOKEN }}
with:
source-directory: 'javasdk'
destination-github-username: ${{secrets.ORG_NAME}}
destination-repository-name: 'xi-sdk-resellers-java'
user-email: ${{secrets.ADMIN_EMAIL}}
target-branch: 'feature'
create-target-branch-if-needed: true
- name: Generate Go SDK
run: |
openapi-generator-cli generate --verbose -i openapispec/unified/XI-Resellers-API-Spec.yaml -g go -o ${{ github.workspace }}/gosdk --package-name xi_sdk_resellers
- name: Configure Git for Go SDK
run: |
git config --local user.email ${{secrets.ADMIN_EMAIL}}
git config --local user.name ${{secrets.ORG_NAME}}
- name: Clone Destination Repository
uses: actions/checkout@v4
with:
repository: ingrammicro-xvantage/xi-sdk-resellers-go
path: destination-repo
- name: Create .github/workflows directory if not exists
run: |
mkdir -p ${{ github.workspace }}/gosdk/.github/workflows
- name: Create assets/images directory if not exists
run: |
mkdir -p ${{ github.workspace }}/gosdk/assets/images
- name: Copy workflow and go.mod files to generated Go SDK
run: |
cp -r destination-repo/.github/workflows/* ${{ github.workspace }}/gosdk/.github/workflows
cp -r destination-repo/go.mod ${{ github.workspace }}/gosdk/
cp -r destination-repo/LICENSE ${{ github.workspace }}/gosdk/
cp -r destination-repo/assets/images* ${{ github.workspace }}/gosdk/assets/
cp -r destination-repo/getting-started.md ${{ github.workspace }}/gosdk/
- name: Push Go SDK to Another Repository
uses: cpina/github-action-push-to-another-repository@main
env:
API_TOKEN_GITHUB: ${{ secrets.WORKFLOW_TOKEN }}
with:
source-directory: 'gosdk'
destination-github-username: ${{secrets.ORG_NAME}}
destination-repository-name: 'xi-sdk-resellers-go'
user-email: ${{secrets.ADMIN_EMAIL}}
target-branch: 'feature'
create-target-branch-if-needed: true