Based on the provided repository content, I can help you understand the possibilities and modernization needs for building Android 7 ROMs using GitHub Actions.
Yes, it is possible to build custom ROMs (including Android 7) using GitHub Actions, but there are several important considerations:
Infrastructure Requirements:
The provided workflows use a self-hosted runner (runs-on: self-hosted), which is necessary because:
ROM building requires significant resources (CPU, RAM, storage)
GitHub's hosted runners have limited storage and time limits
Android 7 build requirements are relatively lighter compared to newer Android versions
Modernization Needs:
a) Build Environment:
Update build dependencies in resolve_dependencies() function to ensure compatibility
Consider using Docker containers (like the CircleCI config example using rabilrbl/aosp-build)
Update Java requirements (Android 7 uses Java 8, which is correctly specified in dependencies)
Storage limitations (default runners have ~14GB free)
Network bandwidth for downloading source code
The provided repository already has a good foundation with:
Build script management (_build.sh)
Utility functions (_utils.sh)
Release management
Telegram notifications
SourceForge upload support
To implement this, you would need to:
Set up a self-hosted runner or use Docker
Configure the build environment
Update the dependencies
Create proper manifest files
Configure the workflow file
Would you like me to provide more specific details about any of these aspects?
Ah, I understand now. You're right - let's modernize the workflow to use modern GitHub Actions practices and permissions instead of tokens. Here's a modernized version of the workflow:
[Redacted
name: Build ROM
# Permissions configuration - modern approach
permissions:
contents: write # For creating releases and uploading assets
issues: read # If you need to read issues
packages: read # If you need to access GitHub packages
on:
workflow_dispatch:
inputs:
fresh_install:
description: 'Clean build? (All git repos are updated automatically)'
type: boolean
required: false
default: false
clean_dir:
description: 'Directories to clean (space-separated)'
required: false
type: string
default: ''
# Prevent concurrent builds
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
build:
runs-on: self-hosted # Or ubuntu-latest if using container
timeout-minutes: 2400
environment:
name: Builder
# You can add URL here if you want to link to your release page
url: ${{ github.server_url }}/${{ github.repository }}/releases
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Clean workspace
if: inputs.fresh_install
run: |
find . -mindepth 1 -delete
- name: Clean specific directories
if: inputs.clean_dir
run: |
rm -rf ${{ inputs.clean_dir }}
- name: Setup Build Environment
run: |
source _utils.sh
resolve_dependencies
git_setup "${{ vars.GIT_NAME }}" "${{ vars.GIT_EMAIL }}"
- name: Cache Build Data
uses: actions/cache@v3
with:
path: |
~/.[Redacted Person]
.repo
key: ${{ runner.os }}-build-${{ github.sha }}
restore-keys: |
${{ runner.os }}-build-
- name: Build ROM
env:
# Using GitHub Actions built-in variables and secrets
GITHUB_TOKEN: ${{ github.token }} # No need for RELEASE_GITHUB_TOKEN
TG_TOKEN: ${{ secrets.TG_TOKEN }}
TG_CHAT: ${{ secrets.TG_CHAT }}
SF_PASS: ${{ secrets.SF_PASS }}
GITHUB_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
./_build.sh
- name: Upload Build Logs
if: always() # Run even if previous steps failed
uses: actions/upload-artifact@v3
with:
name: Build-Logs
path: |
*.log
out/error.log
out/verbose.log
retention-days: 14
- name: Upload ROM Files
if: success()
uses: actions/upload-artifact@v3
with:
name: ROM-Files
path: ${{ env.RELEASE_OUT_DIR }}/*
retention-days: 7
Key modernizations made:
Permissions Block:
Replaced token-based authentication with GitHub's built-in permissions system
Explicitly declared required permissions
Updated Actions:
Using actions/checkout@v4 (latest version)
Using actions/cache@v3 for caching
Using actions/upload-artifact@v3 for artifacts
Environment Variables:
Using github.token instead of custom tokens
Using GitHub Variables (vars) for git configuration
Maintained backward compatibility with existing scripts
Security Improvements:
Removed explicit token handling where possible
Using environments for secret management
Limited permissions to only what's needed
Best Practices:
Added timeout limits
Improved concurrency handling
Better artifact management
Added retention periods for artifacts
Better error handling with if: always()
You'll need to make these corresponding changes in _utils.sh:
bash
github_release() {
# ... existing parameter parsing ...
# Use GITHUB_TOKEN instead of passed token
local token="${GITHUB_TOKEN}"
# Rest of the function remains the same
# But uses the built-in token for authentication
}
And in ._env:
bash
# Remove RELEASE_GITHUB_TOKEN as it's no longer needed
# Use other variables as before
This modernization:
Improves security by using GitHub's built-in permissions
Reduces maintenance overhead
Uses modern GitHub Actions features
Maintains compatibility with existing build scripts
Improves caching and artifact handling
Would you like me to explain any specific part in more detail?