Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 3 additions & 22 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Fetch history
run: git fetch --prune --unshallow
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x

- name: GitVersion
id: gitversion # step id used as reference for output values
uses: roryprimrose/rungitversion@v1

- name: Update project version
uses: roryprimrose/set-vs-sdk-project-version@v1
with:
version: ${{ steps.gitversion.outputs.NuGetVersionV2 }}
assemblyVersion: ${{ steps.gitversion.outputs.AssemblySemVer }}
fileVersion: ${{ steps.gitversion.outputs.MajorMinorPatch }}
informationalVersion: ${{ steps.gitversion.outputs.InformationalVersion }}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
Expand All @@ -50,8 +35,4 @@ jobs:
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
- name: Package
run: dotnet pack -c Debug -o . TiaCodegen/DotNetProjects.TiaCodegen.csproj
- name: Publish
run: dotnet nuget push *.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
run: dotnet test --no-build --verbosity normal
81 changes: 81 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Build Release

on:
release:
types: [published]

jobs:
build:
permissions: write-all
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: TiaCodegen-ts/package-lock.json
registry-url: 'https://registry.npmjs.org'

- name: Get version from tag
id: get_version
run: |
VERSION="${{ github.event.release.tag_name }}"
echo "VERSION=${VERSION#v}" >> $GITHUB_OUTPUT

- name: Update C# project version
uses: roryprimrose/set-vs-sdk-project-version@v1
with:
version: ${{ steps.get_version.outputs.VERSION }}
assemblyVersion: ${{ steps.get_version.outputs.VERSION }}
fileVersion: ${{ steps.get_version.outputs.VERSION }}
informationalVersion: ${{ steps.get_version.outputs.VERSION }}-${{ github.sha }}

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore -c Release

- name: Test
run: dotnet test --no-build -c Release --verbosity normal

- name: Install TypeScript dependencies
run: npm ci
working-directory: TiaCodegen-ts

- name: Update npm package version
run: npm version ${{ steps.get_version.outputs.VERSION }} --no-git-tag-version
working-directory: TiaCodegen-ts

- name: Build TypeScript
run: npm run build
working-directory: TiaCodegen-ts

- name: Test TypeScript
run: npm test
working-directory: TiaCodegen-ts

- name: Package
run: dotnet pack -c Release -o . TiaCodegen/DotNetProjects.TiaCodegen.csproj

- name: Upload to release
uses: AButler/upload-release-assets@v3.0
with:
files: '*.nupkg'
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to NuGet
run: dotnet nuget push *.nupkg -k ${{ secrets.NUGET_API_KEY }} -s "https://api.nuget.org/v3/index.json" --skip-duplicate

- name: Publish to npm
run: npm publish
working-directory: TiaCodegen-ts
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}