Build nightly images #40
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 nightly images | |
on: | |
push: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * 5' # Run every friday at midnight | |
env: | |
KERNEL_BRANCH: next | |
jobs: | |
build-image: | |
strategy: | |
matrix: | |
version: ["next", "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.com/postmarketOS/pmbootstrap/ | |
mkdir -p ~/.local/bin | |
ln -s "$PWD/pmbootstrap/pmbootstrap.py" ~/.local/bin/pmbootstrap | |
pmbootstrap --version | |
- name: Set up pmaports | |
run: | | |
echo -e '\n\n' | pmbootstrap init || true | |
cd ~/.local/var/pmbootstrap/cache_git/pmaports | |
git remote add sm7150 https://github.com/sm7150-mainline/pmaports.git | |
DEFAULT_BRANCH=$(git remote show sm7150 | awk '/HEAD branch/ {print $NF}') | |
git fetch sm7150 $DEFAULT_BRANCH | |
git reset --hard sm7150/$DEFAULT_BRANCH | |
- name: Check kernel branch | |
if: matrix.version == 'default' | |
run: | | |
DEFAULT_BRANCH=$(curl -s https://api.github.com/repos/sm7150-mainline/linux | jq '.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/sm7150-mainline/linux.git --single-branch --branch ${{ env.KERNEL_BRANCH }} --depth 1 | |
- name: Choose any SM7150 device in pmbootstrap to build kernel | |
run: | | |
cp xiaomi-davinci.cfg ~/.config/pmbootstrap.cfg | |
- name: Compile kernel with envkernel | |
run: | | |
cd linux | |
shopt -s expand_aliases | |
source ../pmbootstrap/helpers/envkernel.sh | |
make defconfig sm7150.config | |
make -j$(nproc) | |
pmbootstrap build --envkernel linux-postmarketos-qcom-sm7150 | |
- name: Create artifact directory | |
run: | | |
mkdir out | |
- name: Build xiaomi-davinci | |
run: | | |
cp xiaomi-davinci.cfg ~/.config/pmbootstrap.cfg | |
pmbootstrap install --password 147147 | |
pmbootstrap export | |
cp /tmp/postmarketOS-export/boot.img out/boot-xiaomi-davinci.img | |
cp /tmp/postmarketOS-export/xiaomi-davinci.img out/rootfs-xiaomi-davinci.img | |
xz -T0 -9e -v out/rootfs-xiaomi-davinci.img | |
echo -e "n\nn\ny\n" | pmbootstrap zap | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: xiaomi-davinci-${{ matrix.version }} | |
path: out/*-davinci.img* | |
retention-days: 7 | |
- name: Build xiaomi-surya | |
run: | | |
cp xiaomi-surya.cfg ~/.config/pmbootstrap.cfg | |
pmbootstrap install --password 147147 | |
pmbootstrap export | |
cp /tmp/postmarketOS-export/boot.img out/boot-xiaomi-surya.img | |
cp /tmp/postmarketOS-export/xiaomi-surya.img out/rootfs-xiaomi-surya.img | |
xz -T0 -9e -v out/rootfs-xiaomi-surya.img | |
echo -e "n\nn\ny\n" | pmbootstrap zap | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: xiaomi-surya-${{ matrix.version }} | |
path: out/*-surya.img* | |
retention-days: 7 | |
- name: Build xiaomi-sweet | |
run: | | |
cp xiaomi-sweet.cfg ~/.config/pmbootstrap.cfg | |
pmbootstrap install --password 147147 | |
pmbootstrap export | |
cp /tmp/postmarketOS-export/boot.img out/boot-xiaomi-sweet.img | |
cp /tmp/postmarketOS-export/xiaomi-sweet.img out/rootfs-xiaomi-sweet.img | |
xz -T0 -9e -v out/rootfs-xiaomi-sweet.img | |
echo -e "n\nn\ny\n" | pmbootstrap zap | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: xiaomi-sweet-${{ matrix.version }} | |
path: out/*-sweet.img* | |
retention-days: 7 | |
- name: Build xiaomi-sweet_k6a | |
run: | | |
cp xiaomi-sweet_k6a.cfg ~/.config/pmbootstrap.cfg | |
pmbootstrap install --password 147147 | |
pmbootstrap export | |
cp /tmp/postmarketOS-export/boot.img out/boot-xiaomi-sweeet_k6a.img | |
cp /tmp/postmarketOS-export/xiaomi-sweet_k6a.img out/rootfs-xiaomi-sweet_k6a.img | |
xz -T0 -9e -v out/rootfs-xiaomi-sweet_k6a.img | |
echo -e "n\nn\ny\n" | pmbootstrap zap | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: xiaomi-sweet_k6a-${{ matrix.version }} | |
path: out/*-sweet_k6a.img* | |
retention-days: 7 | |
- name: Build xiaomi-toco | |
run: | | |
cp xiaomi-toco.cfg ~/.config/pmbootstrap.cfg | |
pmbootstrap install --password 147147 | |
pmbootstrap export | |
cp /tmp/postmarketOS-export/boot.img out/boot-xiaomi-toco.img | |
cp /tmp/postmarketOS-export/xiaomi-toco.img out/rootfs-xiaomi-toco.img | |
xz -T0 -9e -v out/rootfs-xiaomi-toco.img | |
echo -e "n\nn\ny\n" | pmbootstrap zap | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: xiaomi-toco-${{ matrix.version }} | |
path: out/*-toco.img* | |
retention-days: 7 |