open-simulation-interface-csharp #38
Workflow file for this run
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: CI Workflow | |
on: | |
workflow_dispatch: | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: true # Fetch submodules | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install Protobuf | |
run: choco install protoc --version=3.19.1 # Install protoc using Chocolatey package manager | |
- name: Set up .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.x.x' | |
- name: Run Python script | |
run: | | |
mkdir -p gen | |
python setup.py ${{ github.workspace }}\open-simulation-interface\osi_version.proto.in ${{ github.workspace }}\open-simulation-interface\VERSION ${{ github.workspace }}\open-simulation-interface\osi_version.proto | |
- name: Generate C# code from Protobuf | |
run: protoc --proto_path=C:\ProgramData\chocolatey\lib\protoc\tools --proto_path=${{ github.workspace }}\open-simulation-interface --csharp_out=${{ github.workspace }}\gen ${{ github.workspace }}\open-simulation-interface\*.proto | |
- name: Restore dependencies | |
run: dotnet restore open-simulation-interface-csharp.csproj | |
- name: Build | |
run: dotnet build --configuration Release open-simulation-interface-csharp.csproj | |
- name: Pack NuGet package | |
run: dotnet pack --configuration Release --output ./nupkgs open-simulation-interface-csharp.csproj | |
- name: Publish NuGet package | |
env: | |
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
run: dotnet nuget push ${{ github.workspace }}\nupkgs\*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate | |
- name: Prepare release assets | |
if: github.event_name == 'release' | |
run: | | |
mkdir release | |
cp -r gen release/ | |
- name: Zip release assets | |
if: github.event_name == 'release' | |
uses: vimtor/[email protected] | |
with: | |
files: release/ | |
recursive: true | |
dest: generated-files.zip | |
- name: Install GitHub CLI | |
if: github.event_name == 'release' | |
run: choco install gh | |
- name: Upload release assets | |
if: github.event_name == 'release' | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
gh release upload ${{ github.event.release.tag_name }} generated-files.zip |