name: Build image on: push: branches: - main tags: - v* workflow_dispatch: jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 # Check cache - name: Cache buildroot id: cache uses: actions/cache@v3 with: path: .buildroot key: ${{ runner.os }}-${{ hashFiles('files/configs/arpl_defconfig') }} # Install dependencies - name: Install dependencies run: | sudo apt-get update sudo apt-get install -y libelf-dev qemu-utils sudo cp -f files/board/arpl/overlayfs/usr/bin/yq /usr/bin/yq # Prepare buildroot for first make (for cache) - name: Prepare buildroot if: steps.cache.outputs.cache-hit != 'true' run: | git clone --single-branch -b 2022.02 https://github.com/buildroot/buildroot.git .buildroot # Copy files echo "Copying files" cp -Ru files/* .buildroot cd .buildroot echo "Generating default config" make BR2_EXTERNAL=../external arpl_defconfig echo "First make" make BR2_EXTERNAL=../external # Build incremental from cache - name: Build image id: build run: | VERSION=` sha256sum yq '.replace | explode(.) | to_entries | map([.key])[] | .[]' update-list.yml | while read F; do (cd `dirname ${F}` && sha256sum `basename ${F}` > sha256sum) done yq '.replace | explode(.) | to_entries | map([.key])[] | .[]' update-list.yml | xargs zip -9D "update-${{ steps.build.outputs.VERSION }}.zip" sha256sum update-list.yml # Upload artifact - name: Upload uses: actions/upload-artifact@v3 with: name: Images path: | arpl.img arpl*.vmdk retention-days: 5 # Publish a release if is a tag - name: Release uses: softprops/action-gh-release@v1 if: startsWith(github.ref, 'refs/tags/') with: files: | arpl-${{ steps.build.outputs.VERSION }}.img.zip arpl-${{ steps.build.outputs.VERSION }}.vmdk-dyn.zip arpl-${{ steps.build.outputs.VERSION }}.vmdk-flat.zip update-${{ steps.build.outputs.VERSION }}.zip