Skip to content

add output

add output #19

Workflow file for this run

name: Build
on:
push:
branches: [master, main, develop]
env:
DOTNET_VERSION: '10.0.x'
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
# Desktop builds for all platforms
build-desktop:
name: Build Desktop (${{ matrix.rid }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
rid: win-x64
artifact: MyDesktopApplication-win-x64
- os: windows-latest
rid: win-arm64
artifact: MyDesktopApplication-win-arm64
- os: ubuntu-latest
rid: linux-x64
artifact: MyDesktopApplication-linux-x64
- os: ubuntu-latest
rid: linux-arm64
artifact: MyDesktopApplication-linux-arm64
- os: macos-latest
rid: osx-x64
artifact: MyDesktopApplication-osx-x64
- os: macos-latest
rid: osx-arm64
artifact: MyDesktopApplication-osx-arm64
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Cache NuGet packages
uses: actions/cache@v5
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Packages.props') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Publish
shell: bash
run: |
dotnet publish src/MyDesktopApplication.Desktop/MyDesktopApplication.Desktop.csproj \
--configuration Release \
--runtime ${{ matrix.rid }} \
--self-contained true \
-p:PublishSingleFile=true \
-p:IncludeNativeLibrariesForSelfExtract=true \
--output ./publish/${{ matrix.artifact }}
- name: Upload artifact
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.artifact }}
path: ./publish/${{ matrix.artifact }}
retention-days: 7
# Android build
build-android:
name: Build Android
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Setup Java
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '21'
- name: Install Android workload
run: dotnet workload install android
- name: Cache NuGet packages
uses: actions/cache@v5
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-android-nuget-${{ hashFiles('**/Directory.Packages.props') }}
restore-keys: |
${{ runner.os }}-android-nuget-
- name: Build Android APK
run: |
dotnet publish src/MyDesktopApplication.Android/MyDesktopApplication.Android.csproj \
--configuration Release \
--output ./publish/android
- name: Upload Android artifact
uses: actions/upload-artifact@v6
with:
name: MyDesktopApplication-android
path: ./publish/android/*.apk
retention-days: 7
if-no-files-found: warn
# Create pre-release with all artifacts
pre-release:
name: Create Pre-release
needs: [build-desktop, build-android]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Download all artifacts
uses: actions/download-artifact@v7
with:
path: ./artifacts
merge-multiple: false
- name: Create archives
run: |
mkdir -p ./release
cd ./artifacts
# Create zip for Windows
for dir in MyDesktopApplication-win-*; do
if [ -d "$dir" ]; then
zip -r "../release/${dir}.zip" "$dir"
fi
done
# Create tar.gz for Linux/macOS
for dir in MyDesktopApplication-linux-* MyDesktopApplication-osx-*; do
if [ -d "$dir" ]; then
tar -czvf "../release/${dir}.tar.gz" "$dir"
fi
done
# Copy Android APK
if [ -d "MyDesktopApplication-android" ]; then
cp MyDesktopApplication-android/*.apk ../release/ 2>/dev/null || true
fi
- name: Delete existing dev release
run: |
gh release delete dev --yes || true
git push origin :refs/tags/dev || true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create dev pre-release
uses: softprops/action-gh-release@v2
with:
tag_name: dev
name: Development Build
prerelease: true
files: ./release/*
body: |
## 🚧 Development Build
This is an automatically generated pre-release from the latest commit on `${{ github.ref_name }}`.
**Commit:** ${{ github.sha }}
**Date:** ${{ github.event.head_commit.timestamp }}
### Downloads
- **Windows x64:** MyDesktopApplication-win-x64.zip
- **Windows ARM64:** MyDesktopApplication-win-arm64.zip
- **Linux x64:** MyDesktopApplication-linux-x64.tar.gz
- **Linux ARM64:** MyDesktopApplication-linux-arm64.tar.gz
- **macOS x64:** MyDesktopApplication-osx-x64.tar.gz
- **macOS ARM64:** MyDesktopApplication-osx-arm64.tar.gz
- **Android:** com.mycompany.mydesktopapplication.apk
⚠️ **This is a development build and may be unstable.**
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}