Build, pack and release #19
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: Build, pack and release | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| jobs: | |
| build-binaries: | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| arch: x64 | |
| rid-os: linux | |
| - os: ubuntu-latest | |
| arch: arm64 | |
| rid-os: linux | |
| - os: ubuntu-latest | |
| arch: arm | |
| rid-os: linux | |
| - os: windows-latest | |
| arch: x64 | |
| rid-os: win | |
| - os: windows-latest | |
| arch: x86 | |
| rid-os: win | |
| - os: windows-latest | |
| arch: arm64 | |
| rid-os: win | |
| - os: macos-latest | |
| arch: x64 | |
| rid-os: osx | |
| - os: macos-latest | |
| arch: arm64 | |
| rid-os: osx | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '10.x.x' | |
| - name: Install Linux ARM compilation toolchain | |
| if: matrix.rid-os == 'linux' && matrix.arch == 'arm' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y binutils-arm-linux-gnueabihf gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf | |
| - name: Install Linux ARM64 compilation toolchain | |
| if: matrix.rid-os == 'linux' && matrix.arch == 'arm64' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y binutils-aarch64-linux-gnu gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | |
| - name: Publish Native Project | |
| if: (matrix.rid-os != 'linux') || (matrix.rid-os == 'linux' && matrix.arch == 'x64') | |
| shell: bash | |
| run: | | |
| dotnet publish ./src/RSML.Native/RSML.Native.csproj \ | |
| -c Release \ | |
| -r ${{ matrix.rid-os }}-${{ matrix.arch }} \ | |
| -o ./dist/RSML.Native-${{ matrix.rid-os }}-${{ matrix.arch }} \ | |
| --self-contained true | |
| - name: Publish Native Project (Linux ARM) | |
| if: matrix.rid-os == 'linux' && matrix.arch == 'arm' | |
| shell: bash | |
| run: | | |
| dotnet publish ./src/RSML.Native/RSML.Native.csproj \ | |
| -c Release \ | |
| -r ${{ matrix.rid-os }}-${{ matrix.arch }} \ | |
| -o ./dist/RSML.Native-${{ matrix.rid-os }}-${{ matrix.arch }} \ | |
| -p:ObjCopyName=arm-linux-gnueabihf-objcopy \ | |
| -p:LinkerFlavor=lld \ | |
| --self-contained true | |
| - name: Publish Native Project (Linux ARM64) | |
| if: matrix.rid-os == 'linux' && matrix.arch == 'arm64' | |
| shell: bash | |
| run: | | |
| dotnet publish ./src/RSML.Native/RSML.Native.csproj \ | |
| -c Release \ | |
| -r ${{ matrix.rid-os }}-${{ matrix.arch }} \ | |
| -o ./dist/RSML.Native-${{ matrix.rid-os }}-${{ matrix.arch }} \ | |
| -p:ObjCopyName=aarch64-linux-gnu-objcopy \ | |
| -p:LinkerFlavor=lld \ | |
| --self-contained true | |
| - name: Publish CLI Project | |
| if: (matrix.rid-os != 'linux') || (matrix.rid-os == 'linux' && matrix.arch == 'x64') | |
| shell: bash | |
| run: | | |
| dotnet publish ./src/RSML.CLI/RSML.CLI.csproj \ | |
| -c Release \ | |
| -r ${{ matrix.rid-os }}-${{ matrix.arch }} \ | |
| -o ./dist/RSML.CLI-${{ matrix.rid-os }}-${{ matrix.arch }} \ | |
| --self-contained true | |
| - name: Publish CLI Project (Linux ARM) | |
| if: matrix.rid-os == 'linux' && matrix.arch == 'arm' | |
| shell: bash | |
| run: | | |
| dotnet publish ./src/RSML.CLI/RSML.CLI.csproj \ | |
| -c Release \ | |
| -r ${{ matrix.rid-os }}-${{ matrix.arch }} \ | |
| -o ./dist/RSML.CLI-${{ matrix.rid-os }}-${{ matrix.arch }} \ | |
| -p:ObjCopyName=arm-linux-gnueabihf-objcopy \ | |
| -p:LinkerFlavor=lld \ | |
| --self-contained true | |
| - name: Publish CLI Project (Linux ARM64) | |
| if: matrix.rid-os == 'linux' && matrix.arch == 'arm64' | |
| shell: bash | |
| run: | | |
| dotnet publish ./src/RSML.CLI/RSML.CLI.csproj \ | |
| -c Release \ | |
| -r ${{ matrix.rid-os }}-${{ matrix.arch }} \ | |
| -o ./dist/RSML.CLI-${{ matrix.rid-os }}-${{ matrix.arch }} \ | |
| -p:ObjCopyName=aarch64-linux-gnu-objcopy \ | |
| -p:LinkerFlavor=lld \ | |
| --self-contained true | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: binaries-${{ matrix.rid-os }}-${{ matrix.arch }} | |
| path: ./dist/ | |
| deploy: | |
| permissions: | |
| id-token: write | |
| contents: read | |
| needs: build-binaries | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '10.0.x' | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v7 | |
| with: | |
| node-version: 24 | |
| - name: Download All Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ./all-binaries | |
| - name: Restore & Build Solution | |
| run: | | |
| dotnet restore | |
| dotnet build --configuration Release --no-restore | |
| - name: Pack Projects | |
| run: dotnet pack --configuration Release --no-build --output ./nupkgs | |
| # Get a short-lived NuGet API key | |
| - name: NuGet login (OIDC → temp API key) | |
| uses: NuGet/login@v1 | |
| id: login | |
| with: | |
| user: ${{ secrets.NUGET_USER }} | |
| #- name: Push to NuGet | |
| # run: | | |
| # dotnet nuget push "./nupkgs/*.nupkg" \ | |
| # --api-key ${{ steps.login.outputs.NUGET_API_KEY }} \ | |
| # --source "https://api.nuget.org/v3/index.json" \ | |
| # --skip-duplicate | |
| - name: Generate changelog | |
| run: | | |
| npx git-cliff@latest -o ${{ github.workspace }}-CHANGELOG.md --latest | |
| - name: Prepare Release Assets | |
| run: | | |
| mkdir ./release-assets | |
| cd ./all-binaries | |
| for dir in *; do | |
| tar -czf "../release-assets/${dir}.tar.gz" -C "$dir" . | |
| done | |
| #- name: Create GitHub Release | |
| # uses: softprops/action-gh-release@v3 | |
| # with: | |
| # files: ./release-assets/*.tar.gz | |
| # body_path: ${{ github.workspace }}-CHANGELOG.txt | |
| # name: RSML ${{ github.ref_name }} |