lightswitch 0.4.0

CPU profiler as a library for Linux suitable for on-demand and continuous profiling
name: build container image
on:
  pull_request:
  push:
      branches:
        - main

jobs:
  container:
    runs-on: ubuntu-22.04
    permissions:
      id-token: write
      contents: read
      packages: write

    steps:
    - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
    - uses: DeterminateSystems/nix-installer-action@c5a866b6ab867e88becbed4467b93592bce69f8a # v21
    - uses: DeterminateSystems/flakehub-cache-action@b346310c0af974cf01100bfb63602580e7f9f97a # v2

    - name: Show nix version
      run: nix --version
    - name: Set up nix dev env
      run: nix develop --command echo 0
    - name: Build container image
      run: nix build .#container
    - name: Push container image on commits to main
      if: ${{ github.repository_owner == 'javierhonduco' && github.ref_name == 'main' }}
      run: |
        nix develop --ignore-environment --command skopeo copy --dest-creds="${{ github.repository_owner }}:${{ github.token }}" docker-archive:./result docker://ghcr.io/javierhonduco/lightswitch:main-${{ github.sha }}