diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6295adbf..10cb1bdd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,9 +2,15 @@ name: Build img # Controls when the workflow will run on: - # Triggers the workflow on push or pull request events but only for the "main" branch + # push: +# branches: +# - main # pull_request: + + # When a release is published + release: + types: [published] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -23,30 +29,89 @@ jobs: with: submodules: recursive - # Install missing buildroot dependency - - name: Install packages + - name: Cache buildroot + id: cache + uses: actions/cache@v2 + with: + path: .buildroot + key: ${{ runner.os }}-${{ hashFiles('files/configs/arpl_defconfig') }} + + # Prepare buildroot for first make (for cache) + - name: Prepare buildroot + if: steps.cache.outputs.cache-hit != 'true' run: | + git clone https://github.com/buildroot/buildroot.git .buildroot sudo apt-get update sudo apt-get install -y libelf-dev + # Copy files + echo "Copying files" + cp -Ru files/* .buildroot + cd .buildroot + echo "Generating default config" + make arpl_defconfig + echo "First make" + make - # Runs a set of commands using the runners shell - - name: Build img + # Build incremental from cache + - name: Build image id: build run: | VERSION=`