Build & Release #41
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 & Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Tag / version (e.g. v1.2.3)' | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write | |
| jobs: | |
| # ---------- BUILD ---------- | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| DOTNET_RESTORE_LOCKED_MODE: false | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: windows-latest | |
| rid: win-x64 | |
| fw: net9.0-desktop | |
| art: win-x64 | |
| binary_name: Alua.exe | |
| - os: macos-latest | |
| rid: osx-arm64 | |
| fw: net9.0-desktop | |
| art: osx-arm64 | |
| binary_name: Alua.app | |
| - os: ubuntu-latest | |
| rid: linux-x64 | |
| fw: net9.0-desktop | |
| art: linux-x64 | |
| binary_name: Alua | |
| - os: ubuntu-latest | |
| rid: android-arm64 | |
| fw: net9.0-android | |
| art: android-arm64 | |
| binary_name: net.rarisma.gravity-Signed.apk | |
| steps: | |
| # 1 ─ Checkout repositories | |
| - name: Checkout AluaAchievements | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: Rarisma/AluaAchievements | |
| path: AluaAchievements | |
| - name: Checkout SACHYA | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: rarisma/sachya | |
| path: SACHYA | |
| - name: Checkout Alua | |
| uses: actions/checkout@v4 | |
| with: | |
| path: Alua | |
| # 2 ─ Install the .NET SDK | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '9.0.x' | |
| # 3 ─ Install required workloads | |
| - name: Install .NET workloads | |
| run: dotnet workload install android | |
| # 4 ─ Update appsettings.json with content from secret | |
| - name: Update appsettings.json with content from secret | |
| shell: bash | |
| run: | | |
| echo '${{ secrets.ENVCONTENT }}' > Alua/Alua/appsettings.json | |
| # 5 ─ Extract version from input | |
| - name: Extract version number | |
| id: extract_version | |
| run: echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT | |
| # 6 ─ Restore dependencies | |
| - name: Restore dependencies | |
| run: dotnet restore Alua/Alua.sln | |
| # 7 ─ Clean publish directory | |
| - name: Clean publish directory (macOS/Linux) | |
| if: matrix.os != 'windows-latest' | |
| run: rm -rf publish | |
| - name: Clean publish directory (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: Remove-Item -Path publish -Recurse -Force -ErrorAction SilentlyContinue | |
| # 8 ─ Build and publish | |
| - name: Publish (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| dotnet publish Alua/Alua/Alua.csproj ` | |
| -c Release ` | |
| -f ${{ matrix.fw }} ` | |
| -r ${{ matrix.rid }} ` | |
| -p:UseMonoRuntime=false ` | |
| --self-contained ` | |
| -o publish | |
| - name: Publish (macOS) | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| dotnet publish Alua/Alua/Alua.csproj \ | |
| -c Release \ | |
| -f ${{ matrix.fw }} \ | |
| -r ${{ matrix.rid }} \ | |
| -p:UseMonoRuntime=false \ | |
| --self-contained \ | |
| -o publish | |
| - name: Publish (Linux) | |
| if: matrix.os == 'ubuntu-latest' && matrix.fw == 'net9.0-desktop' | |
| run: | | |
| dotnet publish Alua/Alua/Alua.csproj \ | |
| -c Release \ | |
| -f ${{ matrix.fw }} \ | |
| -r ${{ matrix.rid }} \ | |
| -p:UseMonoRuntime=false \ | |
| --self-contained \ | |
| -o publish | |
| - name: Publish (Android) | |
| if: matrix.fw == 'net9.0-android' | |
| run: | | |
| dotnet publish Alua/Alua/Alua.csproj \ | |
| -c Release \ | |
| -f ${{ matrix.fw }} \ | |
| -r ${{ matrix.rid }} \ | |
| -o publish | |
| # Apply font fix for macOS | |
| - name: Apply font fix for macOS | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| # Create the complete App bundle structure | |
| mkdir -p publish/Alua.app/Contents/MacOS | |
| mkdir -p publish/Alua.app/Contents/Resources | |
| # Copy all application files to MacOS directory | |
| cp -R publish/* publish/Alua.app/Contents/MacOS/ 2>/dev/null || true | |
| # Remove the app bundle from itself (avoid recursion) | |
| rm -rf publish/Alua.app/Contents/MacOS/Alua.app | |
| # Find and copy font files directly to where they're needed | |
| if [ -f "publish/Alua.app/Contents/MacOS/Uno.Fonts.Fluent/Fonts/uno-fluentui-assets.ttf" ]; then | |
| # Create the font directory structure in MacOS if it doesn't exist | |
| mkdir -p publish/Alua.app/Contents/MacOS/Uno.Fonts.Fluent/Fonts | |
| # The font is already in the right place, no action needed | |
| echo "Font file already exists in MacOS directory" | |
| elif [ -f "publish/Alua.app/Contents/MacOS/Fonts/uno-fluentui-assets.ttf" ]; then | |
| # Copy from Fonts directory to Uno.Fonts.Fluent/Fonts directory | |
| mkdir -p publish/Alua.app/Contents/MacOS/Uno.Fonts.Fluent/Fonts | |
| cp "publish/Alua.app/Contents/MacOS/Fonts/uno-fluentui-assets.ttf" \ | |
| "publish/Alua.app/Contents/MacOS/Uno.Fonts.Fluent/Fonts/uno-fluentui-assets.ttf" | |
| echo "Copied font file from Fonts to Uno.Fonts.Fluent/Fonts" | |
| fi | |
| # Verify the structure was created | |
| echo "App bundle structure:" | |
| ls -la publish/Alua.app/Contents/ | |
| echo "MacOS contents:" | |
| ls -la publish/Alua.app/Contents/MacOS/ | head -10 | |
| echo "Font file verification:" | |
| find publish/Alua.app/Contents/MacOS -name "*uno-fluentui-assets.ttf*" -ls | |
| # Create custom PKG with font fix | |
| - name: Create macOS PKG with font fix | |
| if: matrix.os == 'macos-latest' | |
| run: | | |
| # Create package build structure | |
| mkdir -p pkg-build/Applications | |
| cp -R publish/Alua.app pkg-build/Applications/ | |
| # Create the PKG installer | |
| pkgbuild --root pkg-build \ | |
| --identifier net.rarisma.gravity \ | |
| --version ${{ steps.extract_version.outputs.version }} \ | |
| --install-location / \ | |
| alua-${{ matrix.art }}.pkg | |
| # 9 ─ Package artifacts | |
| - name: Package Windows artifact | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| cd publish | |
| Compress-Archive -Path * -DestinationPath ../alua-${{ matrix.art }}.zip | |
| - name: Package Linux artifact | |
| if: matrix.os == 'ubuntu-latest' && matrix.fw == 'net9.0-desktop' | |
| run: | | |
| cd publish | |
| tar -czf ../alua-${{ matrix.art }}.tar.gz * | |
| - name: Package Android artifact | |
| if: matrix.fw == 'net9.0-android' | |
| run: | | |
| cd publish | |
| cp *.apk ../alua-${{ matrix.art }}.apk | |
| # 10 ─ Upload artifacts | |
| - name: Upload build artifacts (Windows) | |
| if: matrix.os == 'windows-latest' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: alua-${{ matrix.art }} | |
| path: alua-${{ matrix.art }}.zip | |
| - name: Upload build artifacts (macOS) | |
| if: matrix.os == 'macos-latest' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: alua-${{ matrix.art }} | |
| path: alua-${{ matrix.art }}.pkg | |
| - name: Upload build artifacts (Linux) | |
| if: matrix.os == 'ubuntu-latest' && matrix.fw == 'net9.0-desktop' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: alua-${{ matrix.art }} | |
| path: alua-${{ matrix.art }}.tar.gz | |
| - name: Upload build artifacts (Android) | |
| if: matrix.fw == 'net9.0-android' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: alua-${{ matrix.art }} | |
| path: alua-${{ matrix.art }}.apk | |
| # ---------- RELEASE ---------- | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.event.inputs.version }} | |
| name: Release ${{ github.event.inputs.version }} | |
| files: | | |
| alua-win-x64/alua-win-x64.zip | |
| alua-osx-arm64/alua-osx-arm64.pkg | |
| alua-linux-x64/alua-linux-x64.tar.gz | |
| alua-android-arm64/alua-android-arm64.apk | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |