Skip to content

add output

add output #2

Workflow file for this run

name: Build
on:
push:
branches: [master, main, develop]
jobs:
# Build Desktop platforms
build-desktop:
strategy:
matrix:
include:
- os: windows-latest
rid: win-x64
artifact: windows-x64
- os: windows-latest
rid: win-arm64
artifact: windows-arm64
- os: ubuntu-latest
rid: linux-x64
artifact: linux-x64
- os: ubuntu-latest
rid: linux-arm64
artifact: linux-arm64
- os: macos-latest
rid: osx-x64
artifact: macos-x64
- os: macos-latest
rid: osx-arm64
artifact: macos-arm64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'
- name: Restore
run: dotnet restore src/MyDesktopApplication.Desktop/MyDesktopApplication.Desktop.csproj
- name: Publish
shell: bash
run: |
dotnet publish src/MyDesktopApplication.Desktop/MyDesktopApplication.Desktop.csproj \
--configuration Release \
--runtime ${{ matrix.rid }} \
--self-contained true \
--output ./publish/${{ matrix.artifact }}
- name: Create archive (Windows)
if: startsWith(matrix.rid, 'win')
shell: pwsh
run: Compress-Archive -Path ./publish/${{ matrix.artifact }}/* -DestinationPath ./MyDesktopApplication-${{ matrix.artifact }}.zip
- name: Create archive (Linux/macOS)
if: "!startsWith(matrix.rid, 'win')"
run: tar -czvf MyDesktopApplication-${{ matrix.artifact }}.tar.gz -C ./publish/${{ matrix.artifact }} .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: |
MyDesktopApplication-*.zip
MyDesktopApplication-*.tar.gz
if-no-files-found: error
# Build Android
build-android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Install Android workload
run: dotnet workload install android
- name: Restore
run: dotnet restore src/MyDesktopApplication.Android/MyDesktopApplication.Android.csproj
- name: Build APK
run: |
dotnet publish src/MyDesktopApplication.Android/MyDesktopApplication.Android.csproj \
--configuration Release \
--output ./publish/android
- name: Find and rename APK
run: |
APK_FILE=$(find ./publish/android -name "*.apk" | head -1)
if [ -n "$APK_FILE" ]; then
cp "$APK_FILE" ./MyDesktopApplication-android.apk
else
echo "No APK found, creating placeholder"
touch ./MyDesktopApplication-android.apk
fi
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: android
path: MyDesktopApplication-android.apk
if-no-files-found: warn
# Create pre-release
create-prerelease:
needs: [build-desktop, build-android]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
- name: List artifacts
run: find ./artifacts -type f
- name: Collect release files
run: |
mkdir -p release
find ./artifacts -type f \( -name "*.zip" -o -name "*.tar.gz" -o -name "*.apk" \) -exec cp {} ./release/ \;
ls -la ./release/
- name: Delete existing dev release
run: gh release delete dev --yes || true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Delete dev tag
run: git push origin :refs/tags/dev || true
- name: Create pre-release
uses: softprops/action-gh-release@v2
with:
tag_name: dev
name: Development Build
body: |
Automated development build from commit ${{ github.sha }}
Branch: ${{ github.ref_name }}
Commit: ${{ github.sha }}
**This is a pre-release build and may be unstable.**
prerelease: true
files: ./release/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}