Skip to content

dev

dev #218

Workflow file for this run

name: CD
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
buildCSharp:
name: Build release CSharp
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Generate files and update Assembly Version
shell: bash
run: |
cd ./.generator/SchemaGenerator
dotnet run --genCsModel --genCsInterface --updateVersion
MSG=$(dotnet run --updateVersion | grep "New version")
VERSION=$(echo $MSG | awk -F': ' '{print $2}')
echo "ReleaseVersion $VERSION"
echo "ReleaseVersion=$VERSION" >> $GITHUB_ENV
- name: Create key pair for signing the assembly
if: github.ref == 'refs/heads/master'
working-directory: src/DragonflySchema
run: |
"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\sn.exe" -k LadybugTools.snk
ls
shell: cmd
- name: Build
run: |
dotnet restore
dotnet build --configuration Release /nowarn:CS0472,CS0108
- name: Run Unit Tests
working-directory: src/DragonflySchema.Tests
run: dotnet test --configuration Release
- name: Release CSharp
working-directory: src/DragonflySchema
run: dotnet pack --configuration Release --output ./../../
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: nugetPackage
path: ./*.nupkg
outputs:
tag: ${{ env.ReleaseVersion }}
buildTypeScript:
name: Build release TypeScript
runs-on: ubuntu-latest
env:
CI: ""
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
- name: generate files
run: |
cd ./.generator/SchemaGenerator
dotnet run --genTsModel --updateVersion
- name: Install dependencies
working-directory: src/TypeScriptSDK
run: npm i
- name: Build module
working-directory: src/TypeScriptSDK
run: npm run build
- name: Pack package
working-directory: src/TypeScriptSDK
run: |
npm pack
cp ./*.tgz ./../../
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: npmPackage
path: ./*.tgz
release:
name: both CSharp and TypeScript SDK
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
needs: [buildCSharp, buildTypeScript]
steps:
- uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
- name: Download artifact - nuget
uses: actions/download-artifact@v4
with:
name: nugetPackage
- name: Download artifact - npm
uses: actions/download-artifact@v4
with:
name: npmPackage
- name: Release CSharp
run: dotnet nuget push ./*.nupkg -k ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json
- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish ./*.tgz --access public