diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index daa57e4..74a6c27 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,8 +17,31 @@ env: PYTHON_VERSION: '3.14' jobs: + setup_release: + name: Setup Release + outputs: + publish_release: ${{ steps.setup_release.outputs.publish_release }} + release_body: ${{ steps.setup_release.outputs.release_body }} + release_commit: ${{ steps.setup_release.outputs.release_commit }} + release_generate_release_notes: ${{ steps.setup_release.outputs.release_generate_release_notes }} + release_tag: ${{ steps.setup_release.outputs.release_tag }} + release_version: ${{ steps.setup_release.outputs.release_version }} + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + + - name: Setup Release + id: setup_release + uses: LizardByte/actions/actions/release_setup@200eaeb897a2b065a65cb6f16b41077432007490 # v2026.605.34721 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + build: name: Build (${{ matrix.name }}) + needs: setup_release permissions: contents: read runs-on: ${{ matrix.os }} @@ -172,7 +195,10 @@ jobs: - name: Configure if: matrix.kind != 'msvc' env: + BRANCH: ${{ github.head_ref || github.ref_name }} + BUILD_VERSION: ${{ needs.setup_release.outputs.release_tag }} CC: ${{ matrix.cc }} + COMMIT: ${{ needs.setup_release.outputs.release_commit }} CXX: ${{ matrix.cxx }} run: | cmake \ @@ -186,6 +212,10 @@ jobs: - name: Configure MSVC if: matrix.kind == 'msvc' + env: + BRANCH: ${{ github.head_ref || github.ref_name }} + BUILD_VERSION: ${{ needs.setup_release.outputs.release_tag }} + COMMIT: ${{ needs.setup_release.outputs.release_commit }} run: | cmake ` -DBUILD_DOCS=OFF ` @@ -393,3 +423,70 @@ jobs: flags: ${{ matrix.flag }} token: ${{ secrets.CODECOV_TOKEN }} verbose: true + + release: + name: Release + if: >- + always() && + needs.setup_release.outputs.publish_release == 'true' && + needs.build.result == 'success' && + startsWith(github.repository, 'LizardByte/') + needs: + - build + - setup_release + permissions: + contents: read + runs-on: ubuntu-latest + steps: + - name: Download install artifact (Linux-GCC) + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: install-Linux-GCC + path: install-Linux-GCC + + - name: Download install artifact (Linux-Clang) + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: install-Linux-Clang + path: install-Linux-Clang + + - name: Download install artifact (macOS) + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: install-macOS + path: install-macOS + + - name: Download install artifact (Windows-MinGW-UCRT64) + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: install-Windows-MinGW-UCRT64 + path: install-Windows-MinGW-UCRT64 + + - name: Download install artifact (Windows-MSVC) + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: install-Windows-MSVC + path: install-Windows-MSVC + + - name: Package install artifacts + run: | + mkdir -p artifacts + for name in Linux-GCC Linux-Clang macOS Windows-MinGW-UCRT64 Windows-MSVC; do + zip -r \ + "artifacts/libvirtualhid-${{ needs.setup_release.outputs.release_tag }}-${name}.zip" \ + "install-${name}" + done + + - name: Create/Update GitHub Release + if: needs.setup_release.outputs.publish_release == 'true' + uses: LizardByte/actions/actions/release_create@200eaeb897a2b065a65cb6f16b41077432007490 # v2026.605.34721 + with: + allowUpdates: false + body: ${{ needs.setup_release.outputs.release_body }} + draft: true + generateReleaseNotes: ${{ needs.setup_release.outputs.release_generate_release_notes }} + name: ${{ needs.setup_release.outputs.release_tag }} + prerelease: true + tag: ${{ needs.setup_release.outputs.release_tag }} + token: ${{ secrets.GH_BOT_TOKEN }} + virustotal_api_key: ${{ secrets.VIRUSTOTAL_API_KEY }}