Skip to content

Add release workflow for Linux and Windows#48

Merged
hangzqcom merged 1 commit into
qualcomm:mainfrom
hangzqcom:main
Jun 1, 2026
Merged

Add release workflow for Linux and Windows#48
hangzqcom merged 1 commit into
qualcomm:mainfrom
hangzqcom:main

Conversation

@hangzqcom
Copy link
Copy Markdown
Contributor

This PR adds a GitHub Actions release workflow and a Windows build script to automate the release process for both Linux and Windows drivers.

Changes

.github/workflows/release.yml

  • Triggered by pushing tags matching release-lnx-v* (Linux) or release-win-v* (Windows)
  • Linux: Creates release branch, updates version in src/linux/qcversion.h, builds .deb package via build-deb.sh, publishes GitHub release with zip artifact
  • Windows: Creates release branch, updates version in src/windows/qcversion.h, creates draft GitHub release (Windows build requires local machine with VS + WDK)

build/build_drivers.ps1

  • PowerShell build script for Windows drivers
  • Detects MSBuild via vswhere, WDK via registry
  • Builds all driver projects (filter, ndis, qdss, wdfserial) for x86, x64, arm64
  • Stamps INF versions from src/windows/qcversion.h
  • Generates catalog files via inf2cat
  • Packages output to build/target/Drivers/Windows10/
  • Optional test signing support

Release naming convention

  • Linux: release-lnx-v{version} (e.g. release-lnx-v1.0.6.5)
  • Windows: release-win-v{version} (e.g. release-win-v1.00.94.6)

Testing

Tested on fork hangzqcom/qcom-usb-kernel-drivers:

  • Linux release release-lnx-v1.0.6.5 built and published automatically via GitHub Actions
  • Windows release release-win-v1.00.94.6 draft created by workflow, built locally and published

Comment on lines +61 to +91
run: |
LNX="${{ inputs.linux_version }}"
WIN="${{ inputs.windows_version }}"

if [ -z "$LNX" ] && [ -z "$WIN" ]; then
echo "ERROR: At least one of linux_version or windows_version must be provided."
exit 1
fi

# Validate Linux version format X.X.X.X
if [ -n "$LNX" ]; then
if ! echo "$LNX" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "ERROR: linux_version '$LNX' does not match expected format X.X.X.X"
exit 1
fi
echo "do_linux=true" >> "$GITHUB_OUTPUT"
else
echo "do_linux=false" >> "$GITHUB_OUTPUT"
fi

# Validate Windows version format X.XX.XX.X
if [ -n "$WIN" ]; then
if ! echo "$WIN" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "ERROR: windows_version '$WIN' does not match expected format X.XX.XX.X"
exit 1
fi
echo "do_windows=true" >> "$GITHUB_OUTPUT"
else
echo "do_windows=false" >> "$GITHUB_OUTPUT"
fi

Comment on lines +119 to +130
run: |
VERSION="${{ inputs.linux_version }}"
BRANCH="release-lnx-${VERSION}"

if git ls-remote --exit-code --heads origin "refs/heads/${BRANCH}" >/dev/null 2>&1; then
echo "ERROR: Branch '${BRANCH}' already exists on remote."
exit 1
fi

git checkout -b "$BRANCH"
echo "branch=$BRANCH" >> "$GITHUB_OUTPUT"

Comment on lines +133 to +145
run: |
VERSION="${{ inputs.linux_version }}"
FILE="src/linux/version.h"

sed -i "s/#define DRIVER_VERSION \".*\"/#define DRIVER_VERSION \"${VERSION}\"/" "$FILE"

echo "Updated $FILE:"
cat "$FILE"

# Verify the change landed
grep -q "\"${VERSION}\"" "$FILE" || \
{ echo "ERROR: version.h was not updated correctly"; exit 1; }

Comment on lines +148 to +152
run: |
VERSION="${{ inputs.linux_version }}"
git add src/linux/version.h
git commit -m "Update Linux driver version to ${VERSION}"

Comment on lines +173 to +202
run: |
VERSION="${{ inputs.linux_version }}"
DIR_NAME="qud_${VERSION}_all"
ZIP_NAME="${DIR_NAME}.zip"
DEB_FILE="src/linux/build/qud_${VERSION}_all.deb"

if [ ! -f "$DEB_FILE" ]; then
echo "ERROR: Expected deb not found: $DEB_FILE"
ls src/linux/build/ || true
exit 1
fi

mkdir -p "release_staging/${DIR_NAME}"
cp "$DEB_FILE" "release_staging/${DIR_NAME}/"
cp "src/linux/RELEASES.md" "release_staging/${DIR_NAME}/"

# Prefer src/linux/README.md, fall back to repo root README.md
if [ -f "src/linux/README.md" ]; then
cp "src/linux/README.md" "release_staging/${DIR_NAME}/"
elif [ -f "README.md" ]; then
cp "README.md" "release_staging/${DIR_NAME}/"
fi

(cd release_staging && zip -r "../${ZIP_NAME}" "${DIR_NAME}/")

echo "zip_name=$ZIP_NAME" >> "$GITHUB_OUTPUT"
echo "zip_path=${ZIP_NAME}" >> "$GITHUB_OUTPUT"
echo "Release zip contents:"
unzip -l "$ZIP_NAME"

Comment on lines +297 to +308
run: |
VERSION="${{ inputs.windows_version }}"
BRANCH="release-win-${VERSION}"

if git ls-remote --exit-code --heads origin "refs/heads/${BRANCH}" >/dev/null 2>&1; then
echo "ERROR: Branch '${BRANCH}' already exists on remote."
exit 1
fi

git checkout -b "$BRANCH"
echo "branch=$BRANCH" >> "$GITHUB_OUTPUT"

Comment on lines +311 to +333
run: |
VERSION="${{ inputs.windows_version }}"
# Convert dot-separated version to comma-separated for FILE_VERSION macros
VERSION_COMMA="${VERSION//./, }"
# Also produce the compact comma form used in the header (no spaces)
VERSION_COMMA_COMPACT="${VERSION//./ }"
VERSION_COMMA_COMPACT="${VERSION_COMMA_COMPACT// /,}"

FILE="src/windows/qcversion.h"

# Update QCOM_USB_DRIVERS_PRODUCT_VERSION (bare version, no quotes)
sed -i "s/\(#define QCOM_USB_DRIVERS_PRODUCT_VERSION\s\+\)[^ ]*/\1${VERSION}/" "$FILE"

# Update QCOM_USB_DRIVERS_FILE_VERSION (comma-separated)
sed -i "s/\(#define QCOM_USB_DRIVERS_FILE_VERSION\s\+\)[^[:space:]]*/\1${VERSION_COMMA_COMPACT}/" "$FILE"

echo "Updated $FILE (relevant lines):"
grep -E "QCOM_USB_DRIVERS_(PRODUCT|FILE)_VERSION\b" "$FILE"

# Verify
grep -q "QCOM_USB_DRIVERS_PRODUCT_VERSION ${VERSION}" "$FILE" || \
{ echo "ERROR: PRODUCT_VERSION was not updated correctly"; exit 1; }

Comment on lines +336 to +340
run: |
VERSION="${{ inputs.windows_version }}"
git add src/windows/qcversion.h
git commit -m "Update Windows driver version to ${VERSION}"

Comment on lines +348 to +360
run: |
VERSION="${{ inputs.windows_version }}"
TAG="release-win-v${VERSION}"

if git ls-remote --exit-code --tags origin "refs/tags/${TAG}" >/dev/null 2>&1; then
echo "ERROR: Tag '${TAG}' already exists on remote."
exit 1
fi

git tag -a "$TAG" -m "Windows release v${VERSION}"
git push origin "$TAG"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"

Comment on lines +365 to +389
run: |
VERSION="${{ inputs.windows_version }}"
TAG="${{ steps.tag.outputs.tag }}"
NOTES="${{ inputs.release_notes }}"

if [ -z "$NOTES" ]; then
NOTES="## Windows driver release v${VERSION}

Built from branch \`${{ steps.branch.outputs.branch }}\`.

> **Note:** Attach the signed build artifacts produced by the internal
> Windows build pipeline before publishing this release.
>
> Build locally with: \`.\build\build_drivers.ps1\` (requires Visual Studio + WDK)"
fi

# Windows releases always start as draft because signed artifacts
# must be attached by the internal build pipeline before publishing.
gh release create "$TAG" \
--title "$TAG" \
--notes "$NOTES" \
--draft

echo "✅ Windows draft release created: $TAG"
echo " Attach signed build artifacts and publish when ready." No newline at end of file
@hangzqcom hangzqcom merged commit 354f296 into qualcomm:main Jun 1, 2026
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants