nutek-cipher 2.0.7

Encrypt and decrypt files and text with ease
name: Release with CLI apps

on:
  push:
    tags: ["v*.*.*"] # Trigger on tag pushes (adjust the pattern as needed)

env:
  GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
  CARGO_TERM_COLOR: always

jobs:
  build_and_release:
    # runs-on: ubuntu-latest
    # Set the job to run on the platform specified by the matrix below
    runs-on: ${{ matrix.runner }}
    # Define the build matrix for cross-compilation
    strategy:
      matrix:
        include:
          - name: linux-amd64
            runner: ubuntu-latest
            target: x86_64-unknown-linux-gnu
          - name: linux-musl
            runner: ubuntu-latest
            target: x86_64-unknown-linux-musl
          - name: win-amd64
            runner: windows-latest
            target: x86_64-pc-windows-gnu
          - name: macos-amd64
            runner: macos-latest
            target: x86_64-apple-darwin
          - name: macos-arm64
            runner: macos-latest
            target: aarch64-apple-darwin

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

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

      - name: Setup Cache
        uses: Swatinem/rust-cache@v2

      - name: Build Binary
        run: cargo build --verbose --locked --release --target ${{ matrix.target }}

      - name: Release Binary
        shell: bash
        run: |
          PROJECT_NAME="nutek-cipher"
          BIN_SUFFIX=""
          if [[ "${{ matrix.runner }}" == "windows-latest" ]]; then
            BIN_SUFFIX=".exe"
          fi

          # The built binary output location
          BIN_OUTPUT="target/${{ matrix.target }}/release/${PROJECT_NAME}${BIN_SUFFIX}"


          # Define a better name for the final binary
          BIN_RELEASE="${PROJECT_NAME}-${{ matrix.name }}${BIN_SUFFIX}"
          BIN_RELEASE_VERSIONED="${PROJECT_NAME}-${{ github.ref_name }}-${{ matrix.name }}${BIN_SUFFIX}"

          # Move the built binary where you want it
          mv "${BIN_OUTPUT}" "./${BIN_RELEASE_VERSIONED}"

          # zip "$BIN_RELEASE".zip -9 "$BIN_RELEASE_VERSIONED"
          ./.github/workflows/upload_asset.sh "${BIN_RELEASE_VERSIONED}" $GITHUB_TOKEN