deployvps name change #32
Workflow file for this run
This file contains 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: Create Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
# Linux builds | |
- os: ubuntu-latest | |
rid: linux-x64 | |
optimization: Size | |
- os: ubuntu-latest | |
rid: linux-x64 | |
optimization: Speed | |
- os: ubuntu-latest | |
rid: linux-arm64 | |
optimization: Size | |
- os: ubuntu-latest | |
rid: linux-arm64 | |
optimization: Speed | |
# Windows builds | |
- os: windows-latest | |
rid: win-x86 | |
optimization: Size | |
- os: windows-latest | |
rid: win-x86 | |
optimization: Speed | |
- os: windows-latest | |
rid: win-x64 | |
optimization: Size | |
- os: windows-latest | |
rid: win-x64 | |
optimization: Speed | |
- os: windows-latest | |
rid: win-arm64 | |
optimization: Size | |
- os: windows-latest | |
rid: win-arm64 | |
optimization: Speed | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Setup .NET | |
uses: actions/[email protected] | |
with: | |
dotnet-version: '9.0.x' | |
- name: Cache NuGet packages | |
uses: actions/[email protected] | |
with: | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} | |
restore-keys: | | |
${{ runner.os }}-nuget- | |
- name: Install cross-compilation tools (Linux) | |
if: runner.os == 'Linux' && (matrix.rid == 'linux-arm' || matrix.rid == 'linux-arm64') | |
run: | | |
sudo apt-get update | |
if [ "${{ matrix.rid }}" == "linux-arm" ]; then | |
# Add armhf architecture | |
sudo dpkg --add-architecture armhf | |
# Update repositories | |
sudo sed -i -e 's/deb http/deb [arch=amd64] http/g' /etc/apt/sources.list | |
sudo sed -i -e 's/deb mirror/deb [arch=amd64] mirror/g' /etc/apt/sources.list | |
# Add armhf repositories | |
echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted universe multiverse" | sudo tee /etc/apt/sources.list.d/armhf.list | |
echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/armhf.list | |
echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/armhf.list | |
echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/armhf.list | |
sudo apt-get update | |
sudo apt-get install -y clang llvm binutils-arm-linux-gnueabihf gcc-arm-linux-gnueabihf zlib1g-dev:armhf | |
elif [ "${{ matrix.rid }}" == "linux-arm64" ]; then | |
# Add arm64 architecture | |
sudo dpkg --add-architecture arm64 | |
# Update repositories | |
sudo sed -i -e 's/deb http/deb [arch=amd64] http/g' /etc/apt/sources.list | |
sudo sed -i -e 's/deb mirror/deb [arch=amd64] mirror/g' /etc/apt/sources.list | |
# Add arm64 repositories | |
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted universe multiverse" | sudo tee /etc/apt/sources.list.d/arm64.list | |
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/arm64.list | |
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/arm64.list | |
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/arm64.list | |
sudo apt-get update | |
sudo apt-get install -y clang llvm binutils-aarch64-linux-gnu gcc-aarch64-linux-gnu zlib1g-dev:arm64 | |
fi | |
- name: Restore dependencies | |
run: dotnet restore src/RadioModBackend.NET.csproj | |
- name: Publish | |
run: dotnet publish src/RadioModBackend.NET.csproj --configuration Release --no-restore --runtime ${{ matrix.rid }} --output publish/${{ matrix.rid }}-${{ matrix.optimization }} --verbosity minimal /p:OptimizationPreference=${{ matrix.optimization }} /p:DebugType=None | |
- name: Archive artifacts (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
cd publish | |
zip -r "../${{ matrix.rid }}-${{ matrix.optimization }}.zip" "${{ matrix.rid }}-${{ matrix.optimization }}" | |
- name: Archive artifacts (Windows) | |
if: runner.os == 'Windows' | |
shell: pwsh | |
run: | | |
Compress-Archive -Path "publish\\${{ matrix.rid }}-${{ matrix.optimization }}\\*" -DestinationPath "${{ matrix.rid }}-${{ matrix.optimization }}.zip" | |
- name: Upload artifact | |
uses: actions/[email protected] | |
with: | |
name: ${{ matrix.rid }}-${{ matrix.optimization }} | |
path: ${{ matrix.rid }}-${{ matrix.optimization }}.zip | |
release: | |
name: Create Release | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Artifacts | |
uses: actions/[email protected] | |
with: | |
path: . | |
- name: Create Release | |
uses: softprops/[email protected] | |
with: | |
files: '**/*.zip' | |
tag_name: ${{ github.ref_name }} | |
name: Release ${{ github.ref_name }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |