main.yml: General clean-up. #21
This file contains 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
name: Build ROMs Using Crave | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
BASE_PROJECT: | ||
description: "Select base project:" | ||
required: true | ||
default: "lineage-20" | ||
type: choice | ||
options: | ||
- "lineage-20" | ||
- "crdroid-14" | ||
- "arrow-13" | ||
- "derp-13" | ||
BUILD_DIFFERENT_ROM: | ||
description: 'Replace with Repo Init Command' | ||
required: false | ||
default: 'echo "Build Starting!"' | ||
REMOVALS: | ||
description: "Directories to be removed before 'repo':" | ||
default: ".repo/local_manifests" | ||
LOCAL_MANIFEST: | ||
description: 'Personal local manifest(s):' | ||
required: true | ||
default: "https://github.com/sounddrill31/local_manifests" | ||
LOCAL_MANIFEST_BRANCH: | ||
description: "Personal local manifest's branch:" | ||
required: false | ||
default: "lineage-oxygen" | ||
DEVICE_NAME: | ||
description: "Device's codename:" | ||
required: true | ||
default: "oxygen" | ||
MAKEFILE_NAME: | ||
description: "Name of the 'Makefile':" | ||
required: true | ||
default: "lineage_oxygen" | ||
BUILD_COMMAND: | ||
description: 'Command to execute for building:' | ||
required: true | ||
default: 'mka bacon' | ||
BUILD_TYPE: | ||
description: "Select build type:" | ||
required: true | ||
default: 'userdebug' | ||
type: choice | ||
options: | ||
- "eng" | ||
- "userdebug" | ||
- "user" | ||
CLEAN_BUILD: | ||
description: "Produce a clean build through 'crave'?" | ||
required: true | ||
default: 'false' | ||
type: choice | ||
options: | ||
- "true" | ||
- "false" | ||
jobs: | ||
test: | ||
name: Build using foss.crave.io | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checking-out to repository | ||
uses: actions/checkout@v4 | ||
- name: Creating a workspace | ||
run: | | ||
mkdir ${{ github.event.inputs.DEVICE_NAME }} | ||
cd ${{ github.event.inputs.DEVICE_NAME }} | ||
continue-on-error: true | ||
- name: Install 'gh' | ||
run: curl -sS https://webi.sh/gh | sh | ||
- name: Install 'repo' | ||
run: | | ||
mkdir ~/bin | ||
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo | ||
chmod a+x ~/bin/repo | ||
sudo ln -sf ~/bin/repo /usr/bin/repo | ||
- name: Set-up 'git' environment. | ||
run: | | ||
git config --global user.name "${{ github.actor }}" | ||
git config --global user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com" | ||
- name: Set-up 'repo' environment. | ||
run: | | ||
case "${{ github.event.inputs.BASE_PROJECT }}" in | ||
arrow-13) | ||
repo init -u https://github.com/ArrowOS/android_manifest -b arrow-13.1 --git-lf --depth=1 | ||
;; | ||
derp-13) | ||
repo init -u https://github.com/DerpFest-AOSP/manifest -b 13 --git-lf --depth=1 | ||
;; | ||
crdroid-14) | ||
repo init -u https://github.com/crdroidandroid/android -b 14.0 --git-lf --depth=1 | ||
;; | ||
lineage-20) | ||
repo init -u https://github.com/LineageOS/android -b lineage-20.0 --git-lf --depth=1 | ||
;; | ||
esac | ||
id: pwd | ||
- name: Set Up Crave | ||
run: | | ||
rm -rf crave | ||
curl -s https://raw.githubusercontent.com/accupara/crave/master/get_crave.sh | bash -s -- | ||
envsubst < crave.conf.sample >> crave.conf | ||
rm -rf crave.conf.sample | ||
env: | ||
CRAVE_USERNAME: ${{ secrets.CRAVE_USERNAME }} | ||
CRAVE_TOKEN: ${{ secrets.CRAVE_TOKEN }} | ||
- name: Crave Run | ||
run: | | ||
if [ "${{ github.event.inputs.CLEAN_BUILD }}" == "true" ]; then | ||
export CLEAN="--clean" | ||
else | ||
export CLEAN="" | ||
fi | ||
./crave run $CLEAN --no-patch -- "rm -rf ${{ github.event.inputs.REMOVALS }} && \ | ||
# Clone local_manifests repository | ||
${{ github.event.inputs.BUILD_DIFFERENT_ROM }} ; \ | ||
git clone ${{ github.event.inputs.LOCAL_MANIFEST }} --depth 1 -b ${{ github.event.inputs.LOCAL_MANIFEST_BRANCH }} .repo/local_manifests && \ | ||
# Sync the repositories | ||
repo sync -c -j$(nproc --all) --no-clone-bundle --no-tags --optimized-fetch --prune --force-sync && \ | ||
# Set up build environment | ||
export BUILD_USERNAME="${{ github.actor }}" ; \ | ||
export BUILD_HOSTNAME="crave" ; \ | ||
source build/envsetup.sh && \ | ||
# Lunch configuration | ||
lunch ${{ github.event.inputs.MAKEFILE_NAME }}-${{ github.event.inputs.BUILD_TYPE }} && \ | ||
# Build the ROM | ||
make clean && \ | ||
${{ github.event.inputs.BUILD_COMMAND }}" | ||
- name: Execute if the job is cancelled | ||
if: ${{ cancelled() }} | ||
run: ./crave stop --all | ||
- name: Pull Compiled files | ||
run: | | ||
rm -rf oxygen/ | ||
./crave pull out/target/product/*/*.zip | ||
./crave pull out/target/product/*/*.img | ||
- name: Upload to Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
${{ github.event.inputs.DEVICE_NAME }}/recovery.img | ||
${{ github.event.inputs.DEVICE_NAME }}/boot.img | ||
${{ github.event.inputs.DEVICE_NAME }}/vendor_boot.img | ||
${{ github.event.inputs.DEVICE_NAME }}/vendor.img | ||
${{ github.event.inputs.DEVICE_NAME }}/system.img | ||
${{ github.event.inputs.DEVICE_NAME }}/*.zip | ||
name: ${{ github.event.inputs.MAKEFILE_NAME }}-${{ github.run_id }} | ||
tag_name: ${{ github.run_id }} | ||
body: | | ||
Target: ${{ github.event.inputs.MAKEFILE_NAME }}-${{ github.event.inputs.BUILD_TYPE }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |