Slope fix #208
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: Release Application | |
| on: | |
| release: | |
| types: [published] | |
| push: | |
| branches: [main] | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| branches: ["*"] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| packages: write | |
| env: | |
| VCPKG_BINARY_SOURCES: "clear;nuget,GitHub,readwrite" | |
| NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED: "false" | |
| jobs: | |
| package-windows: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| arch: [x64, arm64] | |
| include: | |
| - arch: x64 | |
| triplet: x64-windows | |
| os: windows-latest | |
| - arch: arm64 | |
| triplet: arm64-windows | |
| os: windows-11-arm | |
| env: | |
| VCPKG_TARGET_TRIPLET: ${{ matrix.triplet }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get version from tag | |
| id: version | |
| if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'release' | |
| run: | | |
| if ($env:GITHUB_EVENT_NAME -eq 'release') { | |
| $tag = $env:GITHUB_EVENT_RELEASE_TAG_NAME -replace '^v', '' | |
| } else { | |
| $tag = $env:GITHUB_REF -replace 'refs/tags/v', '' | |
| } | |
| echo "version=$tag" >> $env:GITHUB_OUTPUT | |
| echo "Version: $tag" | |
| - name: Setup NuGet credentials | |
| shell: pwsh | |
| run: | | |
| $owner = "${{ github.repository_owner }}".ToLower() | |
| $feed_url = "https://nuget.pkg.github.com/$owner/index.json" | |
| nuget sources remove -Name "GitHub" -ErrorAction SilentlyContinue | |
| nuget sources add -Name "GitHub" ` | |
| -Source $feed_url ` | |
| -UserName "$owner" ` | |
| -Password "${{ secrets.VCPKG_PAT_TOKEN }}" ` | |
| -StorePasswordInClearText ` | |
| -NonInteractive | |
| nuget setapikey "${{ secrets.VCPKG_PAT_TOKEN }}" -Source $feed_url -NonInteractive | |
| echo "VCPKG_BINARY_SOURCES=clear;nuget,GitHub,readwrite" >> $env:GITHUB_ENV | |
| echo "VCPKG_NUGET_REPOSITORY=$feed_url" >> $env:GITHUB_ENV | |
| - name: Cache NSIS | |
| id: nsis-cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: 'C:\Program Files (x86)\NSIS' | |
| key: nsis-3.11-${{ runner.os }} | |
| - name: Install NSIS | |
| if: steps.nsis-cache.outputs.cache-hit != 'true' | |
| run: choco install nsis -y | |
| - name: Add NSIS to PATH | |
| run: echo "C:\Program Files (x86)\NSIS" >> $env:GITHUB_PATH | |
| - name: Set up MSVC dev cmd | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| with: | |
| arch: ${{ matrix.arch }} | |
| - name: Configure | |
| run: | | |
| $cmakeArgs = @( | |
| "-DVCPKG_TARGET_TRIPLET=${{ env.VCPKG_TARGET_TRIPLET }}", | |
| "-DVCPKG_BUILD_TYPE=release", | |
| "-DVCPKG_VERBOSE=ON" | |
| ) | |
| if ("${{ steps.version.outputs.version }}" -ne "") { | |
| $cmakeArgs += "-DBLAZE_VERSION=${{ steps.version.outputs.version }}" | |
| } | |
| cmake -B build $cmakeArgs | |
| - name: Build | |
| run: cmake --build build --config Release --parallel | |
| - name: Package (NSIS Installer) | |
| run: | | |
| cd build | |
| cpack -C Release -G NSIS | |
| - name: Debug NSIS Failure | |
| if: failure() | |
| run: | | |
| if (Test-Path "build/_CPack_Packages/win64/NSIS/NSISOutput.log") { | |
| Get-Content "build/_CPack_Packages/win64/NSIS/NSISOutput.log" | |
| } | |
| - name: Install package | |
| run: | | |
| $installer = (Get-Item build/Blaze-*.exe).FullName | |
| Start-Process -Wait -FilePath $installer -ArgumentList '/S', '/D=C:\BlazeTest' | |
| - name: Test installed package | |
| run: | | |
| Copy-Item -Recurse C:\BlazeTest\share\assets $env:TEMP\blaze-test | |
| & C:\BlazeTest\bin\blaze-cli.exe $env:TEMP\blaze-test\default_config.json | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: blaze-windows-${{ matrix.arch }}-installer | |
| path: build/Blaze-*.exe | |
| - name: Upload to Release | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| with: | |
| token: ${{ secrets.BLAZE_RELEASE_TOKEN }} | |
| files: build/Blaze-*.exe | |
| package-linux: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - arch: x64 | |
| runner: ubuntu-22.04 | |
| - arch: arm64 | |
| runner: ubuntu-24.04-arm | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get version from tag | |
| id: version | |
| if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'release' | |
| run: | | |
| if [ "$GITHUB_EVENT_NAME" = "release" ]; then | |
| TAG=${GITHUB_EVENT_RELEASE_TAG_NAME#v} | |
| else | |
| TAG=${GITHUB_REF#refs/tags/v} | |
| fi | |
| echo "version=$TAG" >> $GITHUB_OUTPUT | |
| echo "Version: $TAG" | |
| - name: Install dependencies | |
| uses: awalsh128/cache-apt-pkgs-action@v1 | |
| with: | |
| packages: libgdal-dev libopencv-dev cmake libomp-dev rpm qt6-base-dev libglx-dev | |
| libgl1-mesa-dev qt6-image-formats-plugins libqt6svg6-dev ccache mold ninja-build | |
| liblapack-dev libblas-dev liblapack3 libblas3 | |
| install_recommends: true | |
| version: 1.1 | |
| - name: Configure | |
| run: | | |
| CMAKE_ARGS="" | |
| if [ -n "${{ steps.version.outputs.version }}" ]; then | |
| CMAKE_ARGS="-DBLAZE_VERSION=${{ steps.version.outputs.version }}" | |
| fi | |
| cmake -B build $CMAKE_ARGS | |
| - name: Build | |
| run: cmake --build build --config Release | |
| - name: Package (DEB) | |
| run: | | |
| cd build | |
| cpack -C Release -G DEB | |
| - name: Install DEB package | |
| run: | | |
| sudo dpkg -i build/Blaze-*.deb || true | |
| sudo apt-get install -f -y | |
| - name: Test installed package | |
| run: | | |
| cp -r /usr/share/assets /tmp/blaze-test | |
| blaze-cli /tmp/blaze-test/default_config.json | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: blaze-linux-${{ matrix.arch }}-deb | |
| path: build/Blaze-*.deb | |
| - name: Upload to Release | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| with: | |
| token: ${{ secrets.BLAZE_RELEASE_TOKEN }} | |
| files: build/Blaze-*.deb | |
| package-plugin: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get version from tag | |
| id: version | |
| if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'release' | |
| run: | | |
| if [ "$GITHUB_EVENT_NAME" = "release" ]; then | |
| TAG=${GITHUB_EVENT_RELEASE_TAG_NAME#v} | |
| else | |
| TAG=${GITHUB_REF#refs/tags/v} | |
| fi | |
| echo "version=$TAG" >> $GITHUB_OUTPUT | |
| echo "Version: $TAG" | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| if [ -f qgis_plugin/requirements.txt ]; then pip install -r qgis_plugin/requirements.txt; fi | |
| - name: Package Plugin | |
| run: | | |
| cd qgis_plugin | |
| python package_plugin.py | |
| - name: Set plugin zip filename | |
| id: plugin_zip | |
| run: | | |
| cd qgis_plugin | |
| # Find the generated zip file (it will have version in name: blaze_loader_qgis_plugin_v*.zip) | |
| ZIP_FILE=$(ls blaze_loader_qgis_plugin*.zip | head -1) | |
| if [ -z "$ZIP_FILE" ]; then | |
| echo "ERROR: No zip file found" | |
| exit 1 | |
| fi | |
| echo "Found zip: $ZIP_FILE" | |
| echo "zip_path=qgis_plugin/$ZIP_FILE" >> $GITHUB_OUTPUT | |
| echo "zip_name=$ZIP_FILE" >> $GITHUB_OUTPUT | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: blaze-qgis-plugin | |
| path: ${{ steps.plugin_zip.outputs.zip_path }} | |
| - name: Upload to Release | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| with: | |
| token: ${{ secrets.BLAZE_RELEASE_TOKEN }} | |
| files: ${{ steps.plugin_zip.outputs.zip_path }} |