Skip to content

Cross-Platform Build #1

Cross-Platform Build

Cross-Platform Build #1

name: Cross-Platform Build
on:
workflow_dispatch:
inputs:
release_version:
description: "Desired Release Version (e.g., v1.0.0)"
required: true
type: string
release_type:
description: "Release type (release or prerelease)"
required: true
default: "release"
type: choice
options:
- release
- prerelease
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
arch: x64
runtime: win-x64
- os: windows-latest
arch: x86
runtime: win-x86
- os: windows-latest
arch: arm
runtime: win-arm
- os: windows-latest
arch: arm64
runtime: win-arm64
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
- name: Clean project
run: dotnet clean RemoteRun/RemoteRun.csproj
- name: Publish library
run: dotnet publish RemoteRun/RemoteRun.csproj --configuration Release --runtime ${{ matrix.runtime }} --self-contained false /p:UseAppHost=false -o ./publish/${{ matrix.os }}-${{ matrix.arch }}/RemoteRun
- name: Zip ${{ matrix.os }}-${{ matrix.arch }} output
run: |
Compress-Archive -Path ./publish/${{ matrix.os }}-${{ matrix.arch }}/RemoteRun/* -DestinationPath ./RemoteRun-${{ inputs.release_version }}-${{ matrix.os }}-${{ matrix.arch }}.zip
shell: pwsh
- name: Upload ${{ matrix.os }}-${{ matrix.arch }} artifact
uses: actions/upload-artifact@v4
with:
name: RemoteRun-${{ inputs.release_version }}-${{ matrix.os }}-${{ matrix.arch }}.zip
path: ./RemoteRun-${{ inputs.release_version }}-${{ matrix.os }}-${{ matrix.arch }}.zip
overwrite: true
release:
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
steps:
- name: Download all platform artifacts
uses: actions/download-artifact@v4
with:
path: ./release-assets
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
with:
tag_name: ${{ github.event.inputs.release_version }}
name: ${{ github.event.inputs.release_version }}
prerelease: ${{ github.event.inputs.release_type == 'prerelease' }}
files: ./release-assets/**/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}