Skip to content

Commit

Permalink
Merge pull request #37 from fossapps/auto-sdk
Browse files Browse the repository at this point in the history
feat(sdk): introduce automatic sdk generation
  • Loading branch information
cyberhck authored Nov 22, 2020
2 parents 3001c02 + 3965727 commit f751209
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/publish_sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Publish

on:
release:
types: [published]
env:
SERVICE_NAME: micro.keystore
SERVICE_NAME_CAPITALIZED: Micro.Keystore

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.101
- name: 'Load Docker Image'
run: |
TAG="${GITHUB_REF/refs\/tags\/v/}"
docker pull fossapps/$SERVICE_NAME:$TAG
- name: Spin-up Containers
run: |
TAG="${GITHUB_REF/refs\/tags\/v/}"
TAG=$TAG docker-compose -f ./docker-compose.ci.yml up -d
- name: Generate SDKs
run: |
cd ./Sdk
sh ./generate_sdk.sh
- name: pack
run: |
cd Sdk
TAG="${GITHUB_REF/refs\/tags\/v/}"
dotnet pack --include-symbols -p:PackageVersion=$TAG -c Release
- name: release
run: |
cd Sdk
dotnet nuget push ./bin/Release/Fossapps.Micro.KeyStore* -k ${{secrets.NUGET_TOKEN}} -s https://api.nuget.org/v3/index.json
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,4 @@ _Resharper*/
.idea/**/vcs.xml
.idea/**/module.xml
.idea/**/misc.xml
./Sdk/Generated/**
15 changes: 15 additions & 0 deletions Sdk/Sdk.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<PackageId>Fossapps.Micro.KeyStore</PackageId>
<Version>0.0.1</Version>
<Authors>Nishchal Gautam</Authors>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.21" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.5" />
</ItemGroup>
</Project>
3 changes: 3 additions & 0 deletions Sdk/generate_sdk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
mkdir -p Generated
docker run --net=host --rm -v $(pwd)/Generated:/app/sdk node bash -c "apt update && apt install libunwind-dev -y && npm i -g [email protected] && autorest --input-file=http://localhost:5000/swagger/v1/swagger.json --csharp --namespace=Fossapps.Micro.KeyStore --override-client-name=KeyStoreClient --output-folder=/app/sdk --clear-output-folder"

0 comments on commit f751209

Please sign in to comment.