zerus 0.16.1

Lightweight tool for creating project-specific and/or general offline crates.io mirrors
on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

name: binaries

jobs:
  # Check that the release binaries build. The release-plz workflow attaches
  # them to the GitHub release.
  release-bins:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        targets:
          - x86_64-unknown-linux-musl
        bins:
          - zerus

    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
      - uses: dtolnay/rust-toolchain@d1031067263f94b142dd6c0ce24c5eb9d02d52a0 # master
        with:
          toolchain: stable
          target: ${{ matrix.targets }}
      - run: cargo install cargo-quickinstall
      - run: cargo quickinstall cross
      - run: cross build --bin ${{ matrix.bins }} --locked --target ${{ matrix.targets }} --profile=dist

      - name: archive
        run: |
          tar -czvf ${{ matrix.bins }}-${{ matrix.targets }}.tar.gz \
              -C target/${{ matrix.targets }}/dist/ ${{ matrix.bins }}

      - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
        with:
          name: ${{ matrix.bins }}-${{ matrix.targets }}.tar.gz
          path: ${{ matrix.bins }}-${{ matrix.targets }}.tar.gz

      # Build the image here too, so that a broken Dockerfile fails before release.
      - name: build image
        if: matrix.bins == 'zerus'
        run: |
          docker build -t zerus:ci \
              --build-arg BIN=target/${{ matrix.targets }}/dist/${{ matrix.bins }} .

      - name: check that the image runs
        if: matrix.bins == 'zerus'
        run: docker run --rm zerus:ci --version