Conversation
This commit refactors the GitHub Actions workflows to improve efficiency and clarity. The `pull_request` triggers have been removed from both the `build.yml` and `code-quality.yml` workflows, meaning they will now only execute on direct pushes to the `dev`, `qa`, and `main` branches. Key changes in `build.yml`: - **Removed `matrix` strategy**: The build matrix is replaced with a conditional script step (`Determine build type`) that sets the `build-type` and `artifact-suffix` based on the current branch name (`github.ref_name`). - **Simplified job steps**: Subsequent steps now reference the outputs from the new conditional script, making the workflow more dynamic and easier to read. - **Removed pull request trigger**: The workflow no longer runs on pull requests.
This commit refactors the CI/CD workflows to use a unique timestamp (`ddmmyyyyhhmmss`) for the `versionName` and artifact filenames. This ensures every build artifact is uniquely identifiable and traceable.
The static `versionName` has been removed from `build.gradle.kts` and is now passed as a Gradle project property from the GitHub Actions workflows.
Key changes:
- **Dynamic Versioning**: `build.gradle.kts` now accepts a `versionName` property.
- **Timestamp Generation**: The `build.yml` and `production-release.yml` workflows now generate a timestamp at the start of each run.
- **Unified Naming Convention**: Artifacts are now named `keylock-{branch}-{timestamp}-{type}`, making them unique and consistent across all branches.
- **Documentation**: Updated `README.md` and `CI_CD.md` to reflect the new artifact naming convention, dynamic versioning, and instructions for downloading the correct build artifacts.
This commit removes the "Code Quality & Analysis" GitHub Actions workflow. The associated documentation in `README.md` and `CI_CD.md` has been updated to reflect this change, removing all references to the now-deleted workflow and its reports.
There was a problem hiding this comment.
Pull request overview
This pull request refactors the CI/CD pipeline to implement timestamp-based versioning for build artifacts across all branches (dev, qa, main). The changes streamline the build workflow by removing the separate code-quality workflow and consolidating functionality into the main build workflow, while introducing a consistent artifact naming scheme that includes branch names and timestamps.
Changes:
- Implemented timestamp-based versioning (format: ddmmyyyyhhmmss) passed as Gradle property to build.gradle.kts
- Unified build workflow by removing code-quality.yml and consolidating its lint/test functionality into build.yml
- Updated artifact naming to include branch prefix and timestamp (e.g., keylock-dev-{timestamp}-apk)
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| app/build.gradle.kts | Modified versionName to accept dynamic version from Gradle property with fallback to "1.0" |
| .github/workflows/build.yml | Removed pull_request triggers, removed matrix strategy, added timestamp generation and dynamic version passing |
| .github/workflows/production-release.yml | Reorganized to generate timestamp first, updated artifact naming to include "main" prefix, added version property to builds |
| .github/workflows/code-quality.yml | Completely removed - functionality consolidated into build.yml |
| README.md | Updated CI/CD documentation to reflect new artifact naming scheme and timestamp format |
| CI_CD.md | Updated artifact access instructions with new naming patterns and timestamp format |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| cp app/build/outputs/apk/release/*-signed.apk release-artifacts/keylock-main-${{ steps.timestamp.outputs.timestamp }}-signed.apk | ||
| cp app/build/outputs/bundle/release/*.aab release-artifacts/keylock-main-${{ steps.timestamp.outputs.timestamp }}.aab |
There was a problem hiding this comment.
The artifact file names here include the "main-" prefix (e.g., "keylock-main-{timestamp}-signed.apk"), but the release notes generated later in the workflow (lines 97-98) still reference the old naming pattern without the branch prefix (e.g., "keylock-{timestamp}-signed.apk"). This creates an inconsistency where users will look for files with names that don't match the actual artifacts. The release notes should be updated to match this new naming convention.
| **To download APK:** | ||
| 1. Go to GitHub repository → **Actions** tab | ||
| 2. Click the workflow run (shows branch and timestamp) | ||
| 3. Scroll to bottom → "Artifacts" section | ||
| 4. Download artifact (APK for dev/qa, APK+AAB for main) | ||
| 2. Click the **Build KeyLock** workflow run | ||
| 3. Scroll to bottom → **Artifacts** section | ||
| 4. Download artifact: | ||
| - `keylock-dev-{timestamp}-apk` (dev branch) | ||
| - `keylock-qa-{timestamp}-apk` (qa branch) | ||
| - `keylock-main-{timestamp}-release` (main branch) | ||
|
|
||
| **Timestamp format:** `ddmmyyyyhhmmss` (e.g., `24022026143000`) |
There was a problem hiding this comment.
The CI_CD.md documentation still references "code-quality.yml" workflow and describes its jobs (lines 171-176 in the full file), but this workflow file has been completely deleted in this PR. The documentation should be updated to reflect that code quality checks are now integrated into the build.yml workflow's lint and test jobs, rather than being a separate workflow.
| echo "branch-name=qa" >> $GITHUB_OUTPUT | ||
| elif [ "${{ github.ref_name }}" = "main" ]; then | ||
| echo "build-type=release" >> $GITHUB_OUTPUT | ||
| echo "branch-name=main" >> $GITHUB_OUTPUT |
There was a problem hiding this comment.
The conditional logic for determining build type doesn't handle the case where the branch is not dev, qa, or main. While the workflow is currently configured to only run on those three branches, adding an else clause with a fallback or error message would make the workflow more robust and easier to debug if the trigger configuration is ever changed. Consider adding an else clause that either sets default values or exits with an error message.
| echo "branch-name=main" >> $GITHUB_OUTPUT | |
| echo "branch-name=main" >> $GITHUB_OUTPUT | |
| else | |
| echo "Unexpected branch '${{ github.ref_name }}'. Supported branches are 'dev', 'qa', and 'main'." >&2 | |
| exit 1 |
| @@ -6,32 +6,36 @@ on: | |||
| - main | |||
| - qa | |||
| - dev | |||
There was a problem hiding this comment.
The workflow no longer triggers on pull requests, only on direct pushes to dev, qa, and main branches. This means that pull requests will not have automatic builds or tests run against them before merging. This could reduce code quality gates and make it harder to catch issues before they are merged. Consider whether this is intentional, or if pull_request triggers should be retained to maintain pre-merge validation.
| - dev | |
| - dev | |
| pull_request: | |
| branches: | |
| - main | |
| - qa | |
| - dev |
No description provided.