|
1 | | -name: .NET Core Desktop |
2 | | - |
3 | | -on: |
4 | | - workflow_dispatch: |
5 | | - push: |
6 | | - branches: [ "main" ] |
7 | | - pull_request: |
8 | | - |
9 | | -jobs: |
10 | | - |
11 | | - build: |
12 | | - |
13 | | - runs-on: windows-latest |
14 | | - |
15 | | - env: |
16 | | - Dotnet_Version: 8.0.x |
17 | | - Project_Path: Flow.Launcher.Localization\Flow.Launcher.Localization.csproj |
18 | | - |
19 | | - steps: |
20 | | - |
21 | | - # Checkout codes |
22 | | - - name: Checkout |
23 | | - uses: actions/checkout@v4 |
24 | | - |
25 | | - # Install the .NET Core workload |
26 | | - - name: Setup .NET |
27 | | - uses: actions/setup-dotnet@v4 |
28 | | - with: |
29 | | - dotnet-version: ${{ env.Dotnet_Version }} |
30 | | - |
31 | | - # Restore dependencies |
32 | | - - name: Restore dependencies |
33 | | - run: dotnet restore ${{ env.Project_Path }} |
34 | | - |
35 | | - # Build the project |
36 | | - - name: Build |
37 | | - run: dotnet build ${{ env.Project_Path }} --configuration Release --no-restore |
38 | | - |
39 | | - # Execute all unit tests in the solution |
40 | | - - name: Execute unit tests |
41 | | - run: dotnet test --configuration Release --no-build |
42 | | - |
43 | | - # Pack the NuGet package |
44 | | - - name: Create NuGet package |
45 | | - run: dotnet pack ${{ env.Project_Path }} --configuration Release --no-build --output nupkgs |
46 | | - |
47 | | - # Upload the NuGet package |
48 | | - - name: Upload NuGet package |
49 | | - uses: actions/upload-artifact@v4 |
50 | | - with: |
51 | | - name: Full nupkg |
52 | | - path: nupkgs/Flow.Launcher.Localization.*.nupkg |
53 | | - compression-level: 0 |
54 | | - |
55 | | - # Publish to NuGet.org |
56 | | - - name: Push to NuGet |
57 | | - if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
58 | | - run: nuget push nupkgs\*.nupkg -source 'https://api.nuget.org/v3/index.json' -apikey ${{ secrets.NUGET_API_KEY }} |
59 | | - |
60 | | - # Get package version |
61 | | - - name: Get Package Version |
62 | | - if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
63 | | - run: | |
64 | | - $version = [system.diagnostics.fileversioninfo]::getversioninfo("bin\Release\netstandard2.0\Flow.Launcher.Localization.dll").productversion |
65 | | - echo "release_version=$version" | out-file -filepath $env:github_env -encoding utf-8 -append |
66 | | -
|
67 | | - # Publish to GitHub releases |
68 | | - - name: Publish GitHub releases |
69 | | - if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
70 | | - uses: softprops/action-gh-release@v1 |
71 | | - with: |
72 | | - files: "nupkgs\\*.nupkg" |
73 | | - tag_name: "v${{ env.release_version }}" |
| 1 | +name: build |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + tags: |
| 9 | + - '*' |
| 10 | + |
| 11 | +jobs: |
| 12 | + |
| 13 | + build: |
| 14 | + |
| 15 | + runs-on: windows-latest |
| 16 | + |
| 17 | + env: |
| 18 | + Dotnet_Version: 8.0.x |
| 19 | + Project_Path: Flow.Launcher.Localization\Flow.Launcher.Localization.csproj |
| 20 | + |
| 21 | + steps: |
| 22 | + |
| 23 | + # Checkout codes |
| 24 | + - name: Checkout |
| 25 | + uses: actions/checkout@v4 |
| 26 | + |
| 27 | + # Install the .NET Core workload |
| 28 | + - name: Setup .NET |
| 29 | + uses: actions/setup-dotnet@v4 |
| 30 | + with: |
| 31 | + dotnet-version: ${{ env.Dotnet_Version }} |
| 32 | + |
| 33 | + # Restore dependencies |
| 34 | + - name: Restore dependencies |
| 35 | + run: dotnet restore ${{ env.Project_Path }} |
| 36 | + |
| 37 | + # Build the project |
| 38 | + - name: Build |
| 39 | + run: dotnet build ${{ env.Project_Path }} --configuration Release --no-restore |
| 40 | + |
| 41 | + # Pack the NuGet package |
| 42 | + - name: Create NuGet package |
| 43 | + run: dotnet pack ${{ env.Project_Path }} --configuration Release --no-build --output nupkgs |
| 44 | + |
| 45 | + # # Publish to NuGet.org |
| 46 | + # - name: Push to NuGet |
| 47 | + # if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
| 48 | + # run: nuget push nupkgs\*.nupkg -source 'https://api.nuget.org/v3/index.json' -apikey ${{ secrets.NUGET_API_KEY }} |
| 49 | + |
| 50 | + # Get package version |
| 51 | + - name: Get Package Version |
| 52 | + # if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
| 53 | + run: | |
| 54 | + $version = [system.diagnostics.fileversioninfo]::getversioninfo("bin\Release\netstandard2.0\Flow.Launcher.Localization.dll").productversion |
| 55 | + echo "release_version=$version" | out-file -filepath $env:github_env -encoding utf-8 -append |
| 56 | +
|
| 57 | + # Publish to GitHub releases |
| 58 | + - name: Publish GitHub releases |
| 59 | + # if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
| 60 | + uses: softprops/action-gh-release@v1 |
| 61 | + with: |
| 62 | + files: "nupkgs\\*.nupkg" |
| 63 | + tag_name: "v${{ env.release_version }}" |
0 commit comments