Lock file maintenance #292
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: latest-build | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| paths: | |
| - Dockerfile | |
| - flake.lock | |
| - .github/workflows/build-push-latest.yaml | |
| branches: | |
| - develop | |
| - main | |
| push: | |
| paths: | |
| - Dockerfile | |
| - flake.lock | |
| - .github/workflows/build-push-latest.yaml | |
| tags: | |
| - v* | |
| branches: | |
| - develop | |
| - main | |
| jobs: | |
| docker-build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| nix_channel: | |
| - nixos_channel: "nixos-unstable" | |
| home_manager_version_string: "master" | |
| main_nix_channel: "https://nixos.org/channels/nixos-unstable" | |
| home_manager_channel: "https://github.com/nix-community/home-manager/archive/master.tar.gz" | |
| default_tag: false | |
| - nixos_channel: "nixos-25.11" | |
| home_manager_version_string: "release-25.11" | |
| main_nix_channel: "https://nixos.org/channels/nixos-25.11" | |
| home_manager_channel: "https://github.com/nix-community/home-manager/archive/release-25.11.tar.gz" | |
| default_tag: true | |
| steps: | |
| - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - uses: cachix/install-nix-action@4e002c8ec80594ecd40e759629461e26c8abed15 # v31 | |
| with: | |
| nix_path: nixpkgs=channel:${{matrix.nix_channel.nixos_channel}} | |
| extra_nix_config: | | |
| filter-syscalls = false | |
| experimental-features = nix-command flakes | |
| extra-platforms = aarch64-linux | |
| - uses: DeterminateSystems/flakehub-cache-action@main | |
| - name: Login to Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Docker meta | |
| id: docker_meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/lucernae/devcontainer-nix | |
| flavor: | | |
| latest=false | |
| prefix=${{matrix.nix_channel.nixos_channel}}--- | |
| tags: | | |
| type=raw,value=stable,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | |
| type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'develop') }} | |
| type=raw,value=stable${{ matrix.nix_channel.default_tag && ',prefix=' || '' }},enable=${{ github.ref == format('refs/heads/{0}', 'main') }} | |
| type=raw,value=latest${{ matrix.nix_channel.default_tag && ',prefix=' || '' }},enable=${{ github.ref == format('refs/heads/{0}', 'develop') }} | |
| type=ref,event=branch | |
| type=ref,event=pr | |
| type=ref,event=tag | |
| type=semver,pattern=v{{version}} | |
| type=semver,pattern=v{{major}} | |
| type=semver,pattern=v{{major}}.{{minor}} | |
| type=semver,pattern=v{{major}}.{{minor}}.{{patch}} | |
| type=semver${{ matrix.nix_channel.default_tag && ',prefix=' || '' }},pattern=v{{version}} | |
| type=semver${{ matrix.nix_channel.default_tag && ',prefix=' || '' }},pattern=v{{major}} | |
| type=semver${{ matrix.nix_channel.default_tag && ',prefix=' || '' }},pattern=v{{major}}.{{minor}} | |
| type=semver${{ matrix.nix_channel.default_tag && ',prefix=' || '' }},pattern=v{{major}}.{{minor}}.{{patch}} | |
| - name: Build and push | |
| id: docker_build | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: ${{ github.event.pull_request.base.repo.url == github.event.pull_request.head.repo.url }} | |
| build-args: | | |
| NIXOS_VERSION=${{matrix.nix_channel.nixos_channel}} | |
| MAIN_NIX_CHANNEL=${{matrix.nix_channel.main_nix_channel}} | |
| HOME_MANAGER_CHANNEL=${{matrix.nix_channel.home_manager_channel}} | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ${{ steps.docker_meta.outputs.tags }} | |
| labels: ${{ steps.docker_meta.outputs.labels }} | |
| cache-from: | | |
| type=gha,scope=test | |
| type=gha,scope=prod | |
| cache-to: type=gha,scope=prod | |
| - name: Image digest | |
| run: echo ${{ steps.docker_build.outputs.digest }} | |
| # Commented out. Possibly useful in the future. | |
| # smoke-test: | |
| # runs-on: ubuntu-latest | |
| # needs: | |
| # - docker-build | |
| # strategy: | |
| # fail-fast: false | |
| # matrix: | |
| # docker_platform: | |
| # - linux/amd64 | |
| # - linux/arm64 | |
| # nix_channel: | |
| # - nixos_channel: "nixos-unstable" | |
| # home_manager_version_string: "master" | |
| # main_nix_channel: "https://nixos.org/channels/nixos-unstable" | |
| # home_manager_channel: "https://github.com/nix-community/home-manager/archive/master.tar.gz" | |
| # - nixos_channel: "nixos-25.05" | |
| # home_manager_version_string: "release-25.05" | |
| # main_nix_channel: "https://nixos.org/channels/nixos-25.05" | |
| # home_manager_channel: "https://github.com/nix-community/home-manager/archive/release-25.05.tar.gz" | |
| # steps: | |
| # - uses: actions/checkout@v3 | |
| # - name: Set up QEMU | |
| # uses: docker/setup-qemu-action@v2 | |
| # - name: Set up Docker Buildx | |
| # uses: docker/setup-buildx-action@v2 | |
| # - uses: cachix/install-nix-action@v22 | |
| # with: | |
| # nix_path: nixpkgs=channel:${{matrix.nix_channel.nixos_channel}} | |
| # extra_nix_config: | | |
| # filter-syscalls = false | |
| # experimental-features = nix-command flakes | |
| # extra-platforms = aarch64-linux | |
| # - uses: DeterminateSystems/flakehub-cache-action@main | |
| # - name: Run smoke test | |
| # run: | | |
| # cat << EOF | docker run --rm --platform ${{matrix.docker_platform}} -i ${{needs.docker-build.outputs.docker_output_tags}} bash | |
| # node --version | |
| # nix-shell -p coreutils --run 'uname -a' | |
| # nix-shell -p jq --run "nix eval --impure --expr 'builtins.currentSystem' | jq -r '.'" | |
| # EOF |