diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..d23ee42 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,54 @@ +name: build + +on: + workflow_dispatch: + push: + branches: [ "main" ] + pull_request: + +jobs: + + build: + + runs-on: windows-latest + + env: + Dotnet_Version: 8.0.x + Project_Path: Flow.Launcher.Localization\Flow.Launcher.Localization.csproj + + steps: + + # Checkout codes + - name: Checkout + uses: actions/checkout@v4 + + # Install the .NET Core workload + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: ${{ env.Dotnet_Version }} + + # Restore dependencies + - name: Restore dependencies + run: dotnet restore ${{ env.Project_Path }} + + # Build the project + - name: Build + run: dotnet build ${{ env.Project_Path }} --configuration Release --no-restore + + # Execute all unit tests in the solution + - name: Execute unit tests + if: github.event_name == 'push' && github.ref != 'refs/heads/main' + run: dotnet test --configuration Release --no-build + + # Pack the NuGet package + - name: Create NuGet package + run: dotnet pack ${{ env.Project_Path }} --configuration Release --no-build --output nupkgs + + # Upload the NuGet package + - name: Upload NuGet package + uses: actions/upload-artifact@v4 + with: + name: Full nupkg + path: nupkgs/Flow.Launcher.Localization.*.nupkg + compression-level: 0 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..49adb06 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,63 @@ +name: build + +on: + workflow_dispatch: + push: + branches: + - main + tags: + - '*' + +jobs: + + build: + + runs-on: windows-latest + + env: + Dotnet_Version: 8.0.x + Project_Path: Flow.Launcher.Localization\Flow.Launcher.Localization.csproj + + steps: + + # Checkout codes + - name: Checkout + uses: actions/checkout@v4 + + # Install the .NET Core workload + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: ${{ env.Dotnet_Version }} + + # Restore dependencies + - name: Restore dependencies + run: dotnet restore ${{ env.Project_Path }} + + # Build the project + - name: Build + run: dotnet build ${{ env.Project_Path }} --configuration Release --no-restore + + # Pack the NuGet package + - name: Create NuGet package + run: dotnet pack ${{ env.Project_Path }} --configuration Release --no-build --output nupkgs + + # # Publish to NuGet.org + # - name: Push to NuGet + # if: github.event_name == 'push' && github.ref == 'refs/heads/main' + # run: nuget push nupkgs\*.nupkg -source 'https://api.nuget.org/v3/index.json' -apikey ${{ secrets.NUGET_API_KEY }} + + # Get package version + - name: Get Package Version + # if: github.event_name == 'push' && github.ref == 'refs/heads/main' + run: | + $version = [system.diagnostics.fileversioninfo]::getversioninfo("bin\Release\netstandard2.0\Flow.Launcher.Localization.dll").productversion + echo "release_version=$version" | out-file -filepath $env:github_env -encoding utf-8 -append + + # Publish to GitHub releases + - name: Publish GitHub releases + # if: github.event_name == 'push' && github.ref == 'refs/heads/main' + uses: softprops/action-gh-release@v1 + with: + files: "nupkgs\\*.nupkg" + tag_name: "v${{ env.release_version }}" diff --git a/Flow.Launcher.Localization.Analyzers/Flow.Launcher.Localization.Analyzers.csproj b/Flow.Launcher.Localization.Analyzers/Flow.Launcher.Localization.Analyzers.csproj index b22e7a5..27ac90a 100644 --- a/Flow.Launcher.Localization.Analyzers/Flow.Launcher.Localization.Analyzers.csproj +++ b/Flow.Launcher.Localization.Analyzers/Flow.Launcher.Localization.Analyzers.csproj @@ -1,4 +1,4 @@ - + 1.0.0 diff --git a/Flow.Launcher.Localization.SourceGenerators/Flow.Launcher.Localization.SourceGenerators.csproj b/Flow.Launcher.Localization.SourceGenerators/Flow.Launcher.Localization.SourceGenerators.csproj index 784d8fc..b04890f 100644 --- a/Flow.Launcher.Localization.SourceGenerators/Flow.Launcher.Localization.SourceGenerators.csproj +++ b/Flow.Launcher.Localization.SourceGenerators/Flow.Launcher.Localization.SourceGenerators.csproj @@ -1,4 +1,4 @@ - + 1.0.0