rootfs_build #70
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: rootfs_build | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '30 1 * * 1' | |
jobs: | |
prepare_release: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- | |
id: time | |
uses: nanzm/[email protected] | |
with: | |
format: 'YYYYMMDD' | |
- | |
id: release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.time.outputs.time }} | |
release_name: ${{ steps.time.outputs.time }} | |
draft: false | |
prerelease: false | |
outputs: | |
upload_url: ${{ steps.release.outputs.upload_url }} | |
release_id: ${{ steps.release.outputs.id }} | |
release: | |
runs-on: ubuntu-20.04 | |
needs: prepare_release | |
steps: | |
- | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- | |
id: time | |
uses: nanzm/[email protected] | |
with: | |
format: 'YYYYMMDD' | |
- | |
name: install-build-dependencies | |
shell: bash | |
run: | | |
sudo apt-get update | |
sudo apt install \ | |
gdisk \ | |
zip \ | |
systemd-container \ | |
bmap-tools asciidoc \ | |
libarchive-tools \ | |
git \ | |
build-essential \ | |
cmake \ | |
libarchive-dev \ | |
pkg-config \ | |
libcurl4-openssl-dev \ | |
libgpgme-dev \ | |
libssl-dev \ | |
fakeroot \ | |
dh-autoreconf \ | |
qemu-utils \ | |
qemu-efi-aarch64 \ | |
qemu-system-arm \ | |
qemu-user-static | |
sudo pip3 install meson | |
sudo pip3 install ninja | |
- | |
name: install-pacman | |
shell: bash | |
env: | |
PACMAN_VERSION: 6.0.2 | |
run: | | |
sudo git clone --depth 1 https://gitlab.manjaro.org/packages/core/pacman.git | |
pushd pacman | |
sudo wget https://sources.archlinux.org/other/pacman/pacman-${PACMAN_VERSION}.tar.xz | |
sudo tar -xvf pacman-${PACMAN_VERSION}.tar.xz | |
pushd pacman-${PACMAN_VERSION} | |
sudo patch -p1 -i ../pacman-sync-first-option.patch | |
sudo meson --prefix=/usr \ | |
--buildtype=plain \ | |
-Ddoc=disabled \ | |
-Ddoxygen=enabled \ | |
-Dscriptlet-shell=/usr/bin/bash \ | |
-Dldconfig=/usr/bin/ldconfig \ | |
build | |
sudo meson compile -C build | |
sudo meson install -C build | |
popd | |
sudo install -m644 pacman.conf /etc/pacman.conf | |
sudo install -m644 makepkg.conf /etc/ | |
sudo mkdir -p /etc/pacman.d | |
sudo touch /etc/pacman.d/mirrorlist | |
popd | |
- | |
name: setup-qemu-binfmt | |
shell: bash | |
run: | | |
sudo wget https://raw.githubusercontent.com/manjaro-libhybris/manjaro-arm-tools/master/lib/qemu-static.conf -O /usr/lib/binfmt.d/qemu-static.conf | |
sudo service systemd-binfmt restart | |
- | |
name: install-arch-install-scripts | |
shell: bash | |
env: | |
VERSION: 28 | |
run: | | |
sudo wget https://github.com/archlinux/arch-install-scripts/archive/refs/tags/v${VERSION}.tar.gz -O arch-install-scripts.tar.gz | |
sudo tar -xvf arch-install-scripts.tar.gz | |
sudo make -C arch-install-scripts-${VERSION} | |
sudo make -C arch-install-scripts-${VERSION} check | |
sudo make -C arch-install-scripts-${VERSION} PREFIX=/usr install | |
- | |
name: install-manjaro-arm-tools | |
shell: bash | |
run: | | |
sudo git clone https://github.com/manjaro-libhybris/manjaro-arm-tools | |
install_manjaro_arm_tools() { | |
pkgname=manjaro-arm-tools | |
sudo install -dm777 /usr/share/$pkgname/lib | |
sudo install -dm777 /usr/share/$pkgname/profiles | |
sudo install -d /etc/$pkgname/ | |
sudo install -dm777 /var/lib/$pkgname/{pkg,img,tmp,profiles} | |
sudo install -dm777 /var/cache/$pkgname/{pkg/pkg-cache,img} | |
sudo install -Dm755 $pkgname/lib/* /usr/share/$pkgname/lib/ | |
sudo install -Dm755 $pkgname/bin/* /usr/bin/ | |
sudo install -Dm755 $pkgname/lib/manjaro-arm-tools.conf /etc/manjaro-arm-tools/ | |
} | |
install_manjaro_arm_tools | |
- | |
name: build | |
shell: bash | |
run: | | |
sudo buildrootfs | |
ls -lasih /var/cache/manjaro-arm-tools/img | |
FILE_PATH=$(find /var/cache/manjaro-arm-tools/img -type f -name "*.tar.gz" -exec stat -c '%Y %n' {} \; | sort -nr | awk 'NR==1 {print $2}') | |
cp -v $FILE_PATH . | |
echo "FILE_PATH=$(basename $FILE_PATH)" >> $GITHUB_ENV | |
- | |
id: upload_release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.prepare_release.outputs.upload_url }} | |
asset_path: ./${{ env.FILE_PATH }} | |
asset_name: ${{ env.FILE_PATH }} | |
asset_content_type: application/gzip | |
- | |
name: rollback_release | |
if: failure() | |
uses: author/action-rollback@stable | |
with: | |
release_id: ${{ needs.prepare_release.outputs.release_id }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |