diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml new file mode 100644 index 0000000..4d38583 --- /dev/null +++ b/.github/workflows/build-and-release.yml @@ -0,0 +1,93 @@ +name: Build and Release + +on: + workflow_dispatch: + +permissions: + contents: write + +env: + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + +jobs: + build: + runs-on: windows-2025 + + strategy: + matrix: + arch: [Win32, x64, ARM64] + + steps: + # 1️⃣ Checkout source + - name: Checkout + uses: actions/checkout@v5 + + # 2️⃣ Configure CMake + - name: Configure CMake + shell: pwsh + run: | + cmake -S . -B build-${{ matrix.arch }} -A ${{ matrix.arch }} + + # 3️⃣ Build + - name: Build + shell: pwsh + run: | + cmake --build build-${{ matrix.arch }} --config Release + + # 4️⃣ Package (ZIP) + - name: Package + shell: pwsh + run: | + $out = "ntop-${{ matrix.arch }}.zip" + + if (Test-Path $out) { + Remove-Item $out -Force + } + + Compress-Archive ` + -Path "build-${{ matrix.arch }}\Release\*" ` + -DestinationPath $out + + # 5️⃣ Upload artifact + - name: Upload artifact + uses: actions/upload-artifact@v5 + with: + name: ntop-${{ matrix.arch }} + path: ntop-${{ matrix.arch }}.zip + if-no-files-found: error + + + release: + runs-on: windows-2025 + needs: build + + steps: + # 1️⃣ Checkout (required for release action metadata) + - name: Checkout + uses: actions/checkout@v5 + + # 2️⃣ Download artifacts + - name: Download artifacts + uses: actions/download-artifact@v5 + with: + path: ./artifacts + merge-multiple: true + + # 3️⃣ Create GitHub Release + upload assets + - name: Release + uses: softprops/action-gh-release@v2 + with: + tag_name: v1.0.${{ github.run_number }} + name: Build v1.0.${{ github.run_number }} + body: | + Manual build release: + - Windows x86 (Win32) + - Windows x64 + - Windows ARM64 + + files: | + ./artifacts/ntop-Win32.zip + ./artifacts/ntop-x64.zip + ./artifacts/ntop-ARM64.zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6210ed2..8c09825 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,52 +1,34 @@ -name: NTop CI +name: CI Build -# Trigger on every master branch push and pull request on: - push: - branches: - - master - # Allows you to run this workflow manually from the Actions tab + pull_request: + branches: [master] workflow_dispatch: jobs: build: runs-on: windows-latest + strategy: + matrix: + arch: [x64, ARM64] + steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - - name: Run CMake - run: cmake -DCMAKE_BUILD_TYPE=Release . + - name: Configure CMake + run: cmake -A ${{ matrix.arch }} -B build-${{ matrix.arch }} -DCMAKE_BUILD_TYPE=Release . - - name: Run Build - run: cmake --build . --config Release + - name: Build + run: cmake --build build-${{ matrix.arch }} --config Release - - name: Set version - id: set_version - run: echo "VERSION=v0.3.$((${{ github.run_number }} + 4))" >> $GITHUB_ENV - shell: bash + - name: Package output (ZIP) + run: | + powershell -Command "Compress-Archive -Path build-${{ matrix.arch }}/Release/* -DestinationPath ntop-${{ matrix.arch }}.zip" - - name: create release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ env.VERSION }} - release_name: ${{ env.VERSION }} - body: | - ${{ github.event.head_commit.message }} - draft: false - prerelease: false - - - name: Upload release asset - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload artifact + uses: actions/upload-artifact@v4 with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: .\Release\NTop.exe - asset_name: NTop.exe - asset_content_type: application/vnd.microsoft.portable-executable + name: ntop-${{ matrix.arch }} + path: ntop-${{ matrix.arch }}.zip diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index ae1564a..49e65d5 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1,23 +1,31 @@ name: NTop PR CI -# Trigger on every master branch push and pull request on: pull_request: branches: - master - # Allows you to run this workflow manually from the Actions tab workflow_dispatch: jobs: build: runs-on: windows-latest + strategy: + matrix: + arch: [x64, ARM64] + steps: - name: Checkout uses: actions/checkout@v2 - - name: Run CMake - run: cmake -DCMAKE_BUILD_TYPE=Release . + - name: Configure CMake + run: cmake -A ${{ matrix.arch }} -B build-${{ matrix.arch }} -DCMAKE_BUILD_TYPE=Release . + + - name: Build + run: cmake --build build-${{ matrix.arch }} --config Release - - name: Run Build - run: cmake --build . --config Release + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: ntop-${{ matrix.arch }} + path: build-${{ matrix.arch }}/Release/