Add release workflow for Linux and Windows#48
Merged
Conversation
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.ymlrelease-lnx-v*(Linux) orrelease-win-v*(Windows)src/linux/qcversion.h, builds.debpackage viabuild-deb.sh, publishes GitHub release with zip artifactsrc/windows/qcversion.h, creates draft GitHub release (Windows build requires local machine with VS + WDK)build/build_drivers.ps1src/windows/qcversion.hbuild/target/Drivers/Windows10/Release naming convention
release-lnx-v{version}(e.g.release-lnx-v1.0.6.5)release-win-v{version}(e.g.release-win-v1.00.94.6)Testing
Tested on fork
hangzqcom/qcom-usb-kernel-drivers:release-lnx-v1.0.6.5built and published automatically via GitHub Actionsrelease-win-v1.00.94.6draft created by workflow, built locally and published