Update build.yml #292
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 images | |
on: | |
push: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * 5' # Run every friday at midnight | |
env: | |
KERNEL_BRANCH: 6.12.1 | |
jobs: | |
build-image: | |
strategy: | |
matrix: | |
version: ["default"] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out build configurations | |
uses: actions/checkout@v4 | |
- name: Substitute placeholders in configs | |
run: | | |
find . -type f -name "*.cfg" -exec sed -i "s|HOME|$(echo $HOME)|;s|NPROC|$(nproc)|" {} + | |
- name: Install pmbootstrap from git | |
run: | | |
git clone --depth=1 https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git | |
mkdir -p ~/.local/bin | |
ln -s "$PWD/pmbootstrap/pmbootstrap.py" ~/.local/bin/pmbootstrap | |
pmbootstrap --version | |
- name: Set up pmaports | |
run: | | |
echo -e '\nedge\nfairphone\nfp4\n\n\nphosh\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n' | pmbootstrap init || true | |
cd ~/.local/var/pmbootstrap/cache_git/pmaports | |
git remote add sm7125 https://github.com/99degree/pmaports.git | |
DEFAULT_BRANCH=$(git remote show sm7125 | awk '/HEAD branch/ {print $NF}') | |
git fetch sm7125 $DEFAULT_BRANCH | |
#git reset --hard sm7125/$DEFAULT_BRANCH | |
git checkout 99degree/next -- main/adbd-linux | |
- name: Check kernel branch | |
if: matrix.version == 'default' | |
run: | | |
DEFAULT_BRANCH=$(curl -s https://api.github.com/repos/sm7125-mainline/linux | jq -r '.default_branch') | |
echo "Default branch is $DEFAULT_BRANCH" | |
echo "KERNEL_BRANCH=$DEFAULT_BRANCH" >> $GITHUB_ENV | |
- name: Clone kernel sources | |
run: | | |
#git clone https://github.com/sm7125-mainline/linux.git --single-branch --branch ${{ env.KERNEL_BRANCH }} --depth 1 ./linux | |
- name: Choose any SM7125 device in pmbootstrap to build kernel | |
run: | | |
cp xiaomi-miatoll.cfg ~/.config/pmbootstrap_v3.cfg | |
- name: Compile kernel with envkernel | |
run: | | |
cd linux | |
shopt -s expand_aliases | |
#source ../pmbootstrap/helpers/envkernel.sh | |
#make defconfig sm7125.config | |
#make -j$(nproc) | |
#pmbootstrap build --envkernel linux-postmarketos-qcom-sm7125 | |
- name: Create artifact directory | |
run: | | |
mkdir out | |
- name: Build xiaomi-curtana | |
run: | | |
cp xiaomi-miatoll.cfg ~/.config/pmbootstrap_v3.cfg | |
pmbootstrap install --password 147147 | |
pmbootstrap export | |
cp /tmp/postmarketOS-export/boot.img out/boot-xiaomi-tianma-miatoll.img | |
cp /tmp/postmarketOS-export/xiaomi-miatoll.img out/rootfs-xiaomi-miatoll.img | |
#sed -i 's/tianma/huaxing/g' ~/.config/pmbootstrap_v3.cfg | |
pmbootstrap export | |
cp /tmp/postmarketOS-export/boot.img out/boot-xiaomi-huaxing-miatoll.img | |
xz -T0 -9e -v out/rootfs-xiaomi-miatoll.img | |
echo -e "n\nn\ny\n" | pmbootstrap zap | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: xiaomi-curtana-${{ env.KERNEL_BRANCH }} | |
path: out/*-miatoll.img* | |
retention-days: 7 |