Reclaim ci runner storage. #8
This file contains hidden or 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 and publish ZSWatch CI image | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - zswatch_* | |
| paths: | |
| - Dockerfile.zswatch-ci | |
| - Dockerfile.base | |
| - Dockerfile.ci | |
| - .github/workflows/zswatch-ci-image.yml | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| build-and-push-ci: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Free disk space | |
| run: | | |
| df -h | |
| sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/lib/android /opt/hostedtoolcache/CodeQL | |
| docker system prune -af || true | |
| docker volume prune -f || true | |
| df -h | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push base image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile.base | |
| push: true | |
| tags: | | |
| ghcr.io/zswatch/ci-base:${{ github.ref_name }} | |
| ghcr.io/zswatch/ci-base:latest | |
| - name: Prune buildx cache | |
| run: docker buildx prune -af --keep-storage 5GB | |
| - name: Build and push CI image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile.zswatch-ci | |
| push: true | |
| tags: | | |
| ghcr.io/zswatch/zswatch-ci:latest | |
| ghcr.io/zswatch/zswatch-ci:${{ github.ref_name }} | |
| build-args: | | |
| BASE_IMAGE=ghcr.io/zswatch/ci-base:${{ github.ref_name }} |