1.5.2 #35
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish | |
| on: | |
| release: | |
| types: [published] | |
| jobs: | |
| release: | |
| name: Release | |
| strategy: | |
| matrix: | |
| kind: ["linux", "windows", "macos", "macos-arm64"] | |
| include: | |
| - kind: linux | |
| os: ubuntu-latest | |
| target: linux-x64 | |
| - kind: windows | |
| os: windows-latest | |
| target: win-x64 | |
| - kind: macos | |
| os: macos-latest | |
| target: osx-x64 | |
| - kind: macos-arm64 | |
| os: macos-latest | |
| target: osx-arm64 | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup dotnet | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 9.0.x | |
| - name: Build on MacOS | |
| if: matrix.kind == 'macos' || matrix.kind == 'macos-arm64' | |
| run: | | |
| tag=$(git describe --tags --abbrev=0) | |
| release_name="CodeLineCounter-$tag-${{ matrix.target }}" | |
| dotnet publish CodeLineCounter/CodeLineCounter.csproj --framework net9.0 --runtime "${{ matrix.target }}" -c Release -o "$release_name" /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true /p:UseAppHost=true | |
| zip -r "$release_name.zip" "$release_name" | |
| rm -r "$release_name" | |
| - name: Build on Linux | |
| if: matrix.kind == 'linux' | |
| run: | | |
| tag=$(git describe --tags --abbrev=0) | |
| release_name="CodeLineCounter-$tag-${{ matrix.target }}" | |
| dotnet publish CodeLineCounter/CodeLineCounter.csproj --framework net9.0 --runtime "${{ matrix.target }}" -c Release -o "$release_name" /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true /p:UseAppHost=true | |
| tar czvf "${release_name}.tar.gz" "$release_name" | |
| rm -r "$release_name" | |
| - name: Build on Windows | |
| if: matrix.kind == 'windows' | |
| shell: cmd | |
| run: | | |
| echo Setting tag and release_name | |
| for /f "tokens=*" %%i in ('git describe --tags --abbrev^=0') do (set tag=%%i) | |
| echo Tag is %tag% | |
| set release_name=CodeLineCounter-%tag%-${{ matrix.target }} | |
| echo Release name is %release_name% | |
| echo Building project | |
| dotnet publish CodeLineCounter/CodeLineCounter.csproj --framework net9.0 --runtime ${{ matrix.target }} -c Release -o %release_name% /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true /p:UseAppHost=true | |
| echo Packing files | |
| 7z a -tzip "%release_name%.zip" ".\%release_name%\*" | |
| echo Deleting output directory | |
| rmdir /s /q "%release_name%" | |
| - name: Publish | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: "CodeLineCounter-*" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |