Maximize free space for image build #147
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 Runner | |
on: | |
push: | |
branches: [master, dev] | |
paths: | |
- 'linux/**' | |
pull_request: | |
branches: [master] | |
paths: | |
- 'linux/**' | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/export-runtime | |
# https://github.com/actions/runner-images/issues/2840#issuecomment-790492173 | |
- name: Cleanup Disk | |
run: | | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /opt/ghc | |
sudo rm -rf "/usr/local/share/boost" | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
- name: Build Image | |
run: | | |
docker buildx create --name builder --use --driver docker-container | |
make -C linux build BUILDX_ARGS="--cache-from=type=gha --cache-to=type=gha,mode=max --load" | |
- name: Push Image | |
if: ${{ github.event_name == 'push' }} | |
run: |- | |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
test "$GITHUB_REF_NAME" = master && \ | |
make -C linux push TAG=latest || \ | |
make -C linux push TAG="$GITHUB_REF_NAME" |