CI #98
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: "CI" | |
| on: | |
| push: | |
| branches: | |
| - "main" | |
| pull_request: | |
| types: [opened, synchronize, reopened, closed] | |
| branches: | |
| - "main" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| issues: read | |
| packages: write | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [x86_64-linux] | |
| system: [x86_64-linux] | |
| arch: [amd64] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build all flake outputs | |
| run: om ci | |
| - name: Build And Push Docker image | |
| env: | |
| DOCKER_REGISTRY: ghcr.io | |
| SYSTEM: ${{ matrix.system }} | |
| run: | | |
| for PROFILE in car foot; do | |
| echo "🚧 Building dockerImage-${PROFILE}..." | |
| IMAGE_PATH=$(nix build ".#packages.${SYSTEM}.dockerImage-${PROFILE}" --no-link --print-out-paths) | |
| IMAGE_NAME=$(nix eval --raw ".#packages.${SYSTEM}.dockerImage-${PROFILE}.imageName") | |
| IMAGE_TAG=$(nix eval --raw ".#packages.${SYSTEM}.dockerImage-${PROFILE}.imageTag") | |
| FULL_IMAGE="${IMAGE_NAME}:${IMAGE_TAG}" | |
| echo "📦 Image: ${FULL_IMAGE}" | |
| mkdir -p /tmp/docker-image-${PROFILE} | |
| echo "Extracting image to /tmp/docker-image/image.tar" | |
| gunzip -c "$IMAGE_PATH" > /tmp/docker-image-${PROFILE}/image.tar || cp "$IMAGE_PATH" /tmp/docker-image-${PROFILE}/image.tar | |
| echo "${{ secrets.GITHUB_TOKEN }}" | crane auth login "${DOCKER_REGISTRY}" -u "${{ github.actor }}" --password-stdin | |
| echo "🚀 Pushing ${FULL_IMAGE}..." | |
| crane push /tmp/docker-image-${PROFILE}/image.tar "${FULL_IMAGE}" | |
| rm -rf /tmp/docker-image-${PROFILE} | |
| crane auth logout "${DOCKER_REGISTRY}" | |
| echo "✅ Done pushing ${FULL_IMAGE}" | |
| done |