lupin 1.0.0

A blazing-fast, lightweight steganography tool for concealing secret data within normal files.
Documentation
name: Release

on:
  push:
    tags:
      - "v*"
  workflow_dispatch:

env:
  CARGO_TERM_COLOR: always

jobs:
  create-release:
    name: Create Release
    permissions: write-all
    runs-on: ubuntu-latest
    outputs:
      upload_url: ${{ steps.create_release.outputs.upload_url }}
    steps:
      - name: Create Release
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ github.ref }}
          release_name: Release ${{ github.ref }}
          body: |
            ## [x.y.z] 20xx-yy-zz

            ### Added


            ### Supported Formats

            ### Technical Details

            ### API Stability

            [x.y.z]: https://github.com/niclashedam/lupin/releases/tag/vx.y.z
            ```
          draft: false
          prerelease: false

  build-release:
    name: Build Release Binaries
    permissions: write-all
    needs: create-release
    strategy:
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
            artifact_name: lupin
            asset_name: lupin-linux-x86_64
          - os: windows-latest
            target: x86_64-pc-windows-msvc
            artifact_name: lupin.exe
            asset_name: lupin-windows-x86_64.exe
          - os: macos-latest
            target: x86_64-apple-darwin
            artifact_name: lupin
            asset_name: lupin-macos-x86_64
          - os: macos-latest
            target: aarch64-apple-darwin
            artifact_name: lupin
            asset_name: lupin-macos-aarch64

    runs-on: ${{ matrix.os }}

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}

      - name: Build release binary
        run: cargo build --release --target ${{ matrix.target }}

      - name: Upload Release Asset
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ needs.create-release.outputs.upload_url }}
          asset_path: ./target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
          asset_name: ${{ matrix.asset_name }}
          asset_content_type: application/octet-stream

  publish-crates:
    name: Publish to crates.io
    permissions: write-all
    needs: build-release
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Set up registry token
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        run: |
          if [ -z "$CARGO_REGISTRY_TOKEN" ]; then
            echo "CARGO_REGISTRY_TOKEN is not set. Skipping publish.";
            exit 1;
          fi

      - name: Publish crate
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        run: |
          cargo publish --token "$CARGO_REGISTRY_TOKEN"