diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml index 5d5bd8e..76300da 100644 --- a/.github/workflows/msbuild.yml +++ b/.github/workflows/msbuild.yml @@ -1,25 +1,13 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - name: MSBuild on: push: branches: [ "main" ] - tags: - - '*' pull_request: branches: [ "main" ] env: - # Path to the solution file relative to the root of the project. SOLUTION_FILE_PATH: . - - # Configuration type to build. - # You can convert this to a build matrix if you need coverage of multiple configuration types. - # https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix BUILD_CONFIGURATION: Release permissions: @@ -30,68 +18,77 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + + - name: Add MSBuild to PATH + uses: ilammy/msvc-dev-cmd@v1.4.1 - - name: Add MSBuild to PATH - uses: ilammy/msvc-dev-cmd@v1.4.1 + - name: Set up cache for vcpkg/installed + id: cache-vcpkg + uses: actions/cache@v3 + with: + path: vcpkg/installed + key: ${{ runner.os }}-vcpkg-${{ hashFiles('vcpkg/installed/**/*') }} + restore-keys: | + ${{ runner.os }}-vcpkg- - - name: Set up cache for vcpkg/installed - id: cache-vcpkg - uses: actions/cache@v3 - with: - path: vcpkg/installed - key: ${{ runner.os }}-vcpkg-${{ hashFiles('vcpkg/installed/**/*') }} - restore-keys: | - ${{ runner.os }}-vcpkg- + - name: Build + working-directory: ${{env.GITHUB_WORKSPACE}} + run: | + git submodule update --init + if (-Not (Test-Path -Path vcpkg )) { New-Item -ItemType Directory -Path vcpkg } + cd vcpkg + git init + git remote add origin https://github.com/microsoft/vcpkg.git + git fetch origin --depth 1 + git checkout -b master --track origin/master + .\bootstrap-vcpkg.bat + .\vcpkg integrate install + .\vcpkg install libusb libpcap libsodium ffmpeg qt5 sdl2 vcpkg-tool-ninja + cd .. + cmake "-DCMAKE_TOOLCHAIN_FILE=D:/a/fpv4win/fpv4win/vcpkg/scripts/buildsystems/vcpkg.cmake" -S ./ -B "build" + cmake --build build --config Release --target fpv4win + cp gs.key build/Release/ + Invoke-WebRequest -Uri https://github.com/pbatard/libwdi/releases/download/v1.5.0/zadig-2.8.exe -OutFile build/Release/zadig-2.8.exe + Invoke-WebRequest -Uri https://aka.ms/vs/17/release/vc_redist.x64.exe -OutFile build/Release/vcredist_x64.exe - - name: Build - working-directory: ${{env.GITHUB_WORKSPACE}} - # Add additional options to the MSBuild command line here (like platform or verbosity level). - # See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference - run: | - git submodule update --init - if (-Not (Test-Path -Path vcpkg )) { New-Item -ItemType Directory -Path vcpkg } - cd vcpkg - git init - git remote add origin https://github.com/microsoft/vcpkg.git - git fetch origin --depth 1 - git checkout -b master --track origin/master - .\bootstrap-vcpkg.bat - .\vcpkg integrate install - .\vcpkg install libusb libpcap libsodium ffmpeg qt5 sdl2 vcpkg-tool-ninja - cd .. - cmake "-DCMAKE_TOOLCHAIN_FILE=D:/a/fpv4win/fpv4win/vcpkg/scripts/buildsystems/vcpkg.cmake" -S ./ -B "build" - cmake --build build --config Release --target fpv4win - cp gs.key build/Release/ - Invoke-WebRequest -Uri https://github.com/pbatard/libwdi/releases/download/v1.5.0/zadig-2.8.exe -OutFile build/Release/zadig-2.8.exe - Invoke-WebRequest -Uri https://aka.ms/vs/17/release/vc_redist.x64.exe -OutFile build/Release/vcredist_x64.exe + - name: Upload Artifact + id: upload-artifact + uses: actions/upload-artifact@v4 + with: + name: fpv4win + path: build/Release/ - - name: Deploy - uses: actions/upload-artifact@v4 - with: - name: fpv4win - path: build/Release/ + release: + needs: build + runs-on: windows-latest + steps: + - name: Download Artifact + uses: actions/download-artifact@v4 + with: + name: fpv4win + path: build/Release/ - - name: Create release - if: startsWith(github.ref, 'refs/tags/') - id: create_release - uses: softprops/action-gh-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} - files: | - build/Release/* + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + body: | + Release for version ${{ github.ref }} + draft: false + prerelease: false - - name: Upload release asset - if: startsWith(github.ref, 'refs/tags/') - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: build/Release - asset_name: fpv4win-${{ github.ref }} - asset_content_type: application/octet-stream \ No newline at end of file + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./build/Release/* + asset_name: fpv4win-${{ github.ref }}.zip + asset_content_type: application/zip \ No newline at end of file