|
| 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