diff --git a/.github/workflows/build.yml b/.github/workflows/release.yml similarity index 78% rename from .github/workflows/build.yml rename to .github/workflows/release.yml index 80ab4893a8c..e1768360fbd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: OSQuery Build and Push Latest +name: OSQuery Release permissions: contents: write @@ -13,11 +13,10 @@ on: branches: [master] paths-ignore: - "**/*.md" - - '.github/**' workflow_dispatch: inputs: - tag: - description: "Tag to release (e.g., v1.2.3)" + version: + description: "Version to Release (e.g., v1.2.3)" required: true type: string @@ -38,7 +37,8 @@ jobs: name: "Build C Client for (${{ matrix.os }} ${{ matrix.os_arch }})" runs-on: ${{ matrix.os }} if: | - github.event_name == 'push' || github.event_name == 'workflow_dispatch' + github.event_name == 'push' || + github.event_name == 'workflow_dispatch' defaults: run: shell: bash @@ -151,6 +151,7 @@ jobs: retention-days: 30 compression-level: 9 + create_universal_macos: name: "Create Universal macOS Binary" needs: [build_macos] @@ -206,16 +207,18 @@ jobs: - name: Upload Universal Binary uses: actions/upload-artifact@v4 with: - name: osquery-macos-universal + name: osquery-mac-universal path: artifacts/ retention-days: 30 compression-level: 9 + build_windows: name: "Build C Client for (${{ matrix.os }} ${{ matrix.os_arch }})" runs-on: ${{ matrix.os }} if: | - github.event_name == 'push' || github.event_name == 'workflow_dispatch' + github.event_name == 'push' || + github.event_name == 'workflow_dispatch' defaults: run: shell: cmd @@ -226,7 +229,7 @@ jobs: - name: "Windows x64" os: windows-latest os_arch: x64 - artifact_name: osquery-windows-x64 + artifact_name: osquery-windows-amd64 steps: - name: Checkout @@ -262,3 +265,59 @@ jobs: if-no-files-found: warn retention-days: 30 compression-level: 9 + + + release: + name: "Create Release" + needs: [build_macos, create_universal_macos, build_windows] + runs-on: ubuntu-latest + if: | + github.event_name == 'workflow_dispatch' && + inputs.version != '' + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: release-artifacts + continue-on-error: true + + - name: Prepare release artifacts + run: | + set -e + mkdir -p final-artifacts/clients + + # macOS + if [ -d "release-artifacts/osquery-mac-universal" ]; then + tar -czf "final-artifacts/clients/osquery-macos-universal.tar.gz" \ + -C "release-artifacts/osquery-mac-universal" ${{ env.BINARY_NAME }} + fi + # Windows + if [ -d "release-artifacts/osquery-windows-amd64" ]; then + (cd "release-artifacts/osquery-windows-amd64" && \ + zip "${GITHUB_WORKSPACE}/final-artifacts/clients/osquery-windows-amd64.zip" ${{ env.BINARY_NAME }}.exe) + fi + + ls -lh final-artifacts/clients/ + + - name: Generate release header + run: | + cat > RELEASE_HEADER.md <