on:
  push:
    tags:
      - "v*"
name: Release
jobs:
  build:
    name: Release (crates.io & github.com)
    runs-on: ubuntu-latest
    env:
      BINARY_NAME: fbtoggl
      CARGO_TERM_COLOR: always
    steps:
      - uses: actions/checkout@v6
      - run: cargo login ${CARGO_RELEASE_TOKEN}
        env:
          CARGO_RELEASE_TOKEN: ${{ secrets.CARGO_RELEASE_TOKEN }}
      - run: cargo publish
      - uses: docker://messense/rust-musl-cross:x86_64-musl
        with:
          args: cargo build --release
      - uses: docker://messense/rust-musl-cross:x86_64-musl
        with:
          args: musl-strip target/x86_64-unknown-linux-musl/release/fbtoggl
      - run: cp ./target/x86_64-unknown-linux-musl/release/fbtoggl fbtoggl
      - run: sha512sum fbtoggl > fbtoggl.sha512sum
      - id: github_release
        uses: softprops/action-gh-release@v2
        with:
          name: Release fbtoggl ${{ github.ref_name }}
          generate_release_notes: true
          draft: false
          prerelease: false
          files: |
            fbtoggl
            fbtoggl.sha512sum
