Skip to content

Commit

Permalink
chore(CI): fix TS tests and release
Browse files Browse the repository at this point in the history
  • Loading branch information
MingboPeng committed Sep 29, 2024
1 parent 79e25a5 commit 33cdd16
Showing 1 changed file with 41 additions and 15 deletions.
56 changes: 41 additions & 15 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,42 @@ on:
branches: [master]

jobs:
genNewVersion:
name: Check and get a new version for release
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Get Version
run: |
cd ./.generator/SchemaGenerator
MSG=$(dotnet run --updateVersion | grep "New version")
VERSION=$(echo $MSG | awk -F': ' '{print $2}')
echo "ReleaseVersion $VERSION"
echo "ReleaseVersion=$VERSION" >> $GITHUB_ENV
outputs:
ReleaseVersion: ${{ env.ReleaseVersion }}

buildCSharp:
name: Build release CSharp
runs-on: windows-latest
needs: [genNewVersion]
env:
RELEASE_VERSION: ${{ needs.genNewVersion.outputs.ReleaseVersion }}

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Generate files and update Assembly Version
- name: Generate files
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'
Expand All @@ -37,7 +55,7 @@ jobs:
- name: Build
run: |
dotnet restore
dotnet build --configuration Release /nowarn:CS0472,CS0108
dotnet build --configuration Release
- name: Run Unit Tests
working-directory: src/DragonflySchema.Tests
Expand All @@ -53,14 +71,13 @@ jobs:
name: nugetPackage
path: ./*.nupkg

outputs:
tag: ${{ env.ReleaseVersion }}

buildTypeScript:
name: Build release TypeScript
name: Build TypeScript
runs-on: ubuntu-latest
needs: [genNewVersion]
env:
CI: ""
RELEASE_VERSION: ${{ needs.genNewVersion.outputs.ReleaseVersion }}

steps:
- uses: actions/checkout@v4
Expand All @@ -82,24 +99,33 @@ jobs:
working-directory: src/TypeScriptSDK
run: npm i

- name: Build module
working-directory: src/TypeScriptSDK
run: npm run build
# - name: Build and bundle module
# working-directory: src/TypeScriptSDK
# run: |
# npm run build
# npm run bundle:dts

- name: Pack package
- name: Build and pack package
working-directory: src/TypeScriptSDK
run: |
npm pack
cp ./*.tgz ./../../
- name: Unit tests
working-directory: src/TypescriptSDK.Tests
run: |
npm i ./../TypeScriptSDK/dragonfly-schema-${{env.RELEASE_VERSION}}.tgz
npm i honeybee-schema
npm run test
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: npmPackage
path: ./*.tgz

release:
name: both CSharp and TypeScript SDK
name: Release both CSharp and TypeScript SDK
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
needs: [buildCSharp, buildTypeScript]
Expand Down

0 comments on commit 33cdd16

Please sign in to comment.