|
| 1 | +# 🚀 CI/CD Workflows Collection |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | +A centralized repository containing reusable **GitHub Actions workflows** designed to automate the Android development lifecycle. These pipelines handle tasks such as building APKs, running unit tests, linting code, and creating GitHub releases. |
| 7 | + |
| 8 | +--- |
| 9 | + |
| 10 | +## Available Workflows |
| 11 | + |
| 12 | +| Workflow Name | File Name | Trigger | Description | |
| 13 | +| :--- | :--- | :--- | :--- | |
| 14 | +| **Build & Release APK** | `on_dispatch.yml` | `Tag Push (v*)` | Builds a Debug/Release APK, renames it, and uploads it to GitHub Releases automatically. | |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +## How to Use |
| 19 | + |
| 20 | +To use any of these workflows in your Android project: |
| 21 | + |
| 22 | +1. Create a `.github/workflows` directory in the root of your project. |
| 23 | +2. Copy the desired `.yml` file content from this repository. |
| 24 | +3. Paste it into a new file inside your project (e.g., `.github/workflows/release.yml`). |
| 25 | +4. Configure the required **Secrets** (see below). |
| 26 | + |
| 27 | +--- |
| 28 | + |
| 29 | +## Required Secrets |
| 30 | + |
| 31 | +Some workflows (like the **Release** workflow) require secrets to access external services (like APIs) or to sign the app. |
| 32 | + |
| 33 | +Go to `Settings` > `Secrets and variables` > `Actions` in your target repository and add: |
| 34 | + |
| 35 | +| Secret Name | Required For | Description | |
| 36 | +| :--- | :--- | :--- | |
| 37 | +| `NEWS_API_KEY` | `release.yml` | Your API Key for fetching news (injected into `local.properties`). | |
| 38 | +| `KEYSTORE_PASSWORD` | `release-signed.yml` | *(Optional)* Password for your signing Keystore (if using signed release). | |
| 39 | +| `KEY_ALIAS` | `release-signed.yml` | *(Optional)* Key alias for signing. | |
| 40 | + |
| 41 | +--- |
| 42 | + |
| 43 | +## Example: Build & Release Workflow |
| 44 | + |
| 45 | +This is the standard workflow used to generate an APK and attach it to a release tag. |
| 46 | + |
| 47 | +```yaml |
| 48 | +name: Android Build & Release |
| 49 | + |
| 50 | +on: |
| 51 | + push: |
| 52 | + tags: |
| 53 | + - 'v*' |
| 54 | + |
| 55 | +jobs: |
| 56 | + build: |
| 57 | + runs-on: ubuntu-latest |
| 58 | + steps: |
| 59 | + - uses: actions/checkout@v4 |
| 60 | + - uses: actions/setup-java@v4 |
| 61 | + with: |
| 62 | + java-version: '17' |
| 63 | + distribution: 'temurin' |
| 64 | + |
| 65 | + # Create local.properties with API Key |
| 66 | + - name: Create local.properties |
| 67 | + run: echo "NEWS_API_KEY=${{ secrets.NEWS_API_KEY }}" > local.properties |
| 68 | + |
| 69 | + - name: Build APK |
| 70 | + run: ./gradlew assembleDebug |
| 71 | + |
| 72 | + # Upload to Release... |
0 commit comments