inlyne 0.3.2

Introducing Inlyne, a GPU powered yet browserless tool to help you quickly view markdown files in the blink of an eye.
name: Release

on:
  push:
    tags: ["v[0-9]+.[0-9]+.[0-9]+*"]

jobs:
  release:
    name: ${{ matrix.target }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu

          - os: windows-latest
            target: x86_64-pc-windows-msvc

          - os: macos-latest
            target: x86_64-apple-darwin

          - os: macos-latest
            target: aarch64-apple-darwin

    steps:
    - name: Checkout repository
      uses: actions/checkout@v3
      with:
        fetch-depth: 1

    - name: Install packages (Ubuntu)
      if: matrix.os == 'ubuntu-latest'
      run: |
        ci/ubuntu-install-packages


    - name: Set the version
      id: version
      run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}

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

    - name: Build
      run: |
        cargo build --target ${{ matrix.target }} --profile release-lto --locked

    - name: Build archive
      shell: bash
      run: |
        staging="inlyne-${{ steps.version.outputs.VERSION }}-${{ matrix.target }}"
        comp_out="$staging/completions"

        mkdir -p "$staging"
        mkdir -p "$comp_out"

        cp {README.md,LICENSE,example.png,inlyne.toml.sample} "$staging/"

        if [ "${{ matrix.os }}" = "windows-latest" ]; then
          cp "target/${{ matrix.target }}/release-lto/inlyne.exe" "$staging/"
          inlyne_bin="$staging/inlyne.exe"
        else
          cp "target/${{ matrix.target }}/release-lto/inlyne" "$staging/"
          inlyne_bin="$staging/inlyne"
        fi

        # Skip `aarch64-apple-darwin` for now since it's failing in CI
        if [ "${{ matrix.target }}" != "aarch64-apple-darwin" ]; then
          "$inlyne_bin" --gen-completions bash       > "$comp_out/inlyne.bash"
          "$inlyne_bin" --gen-completions elvish     > "$comp_out/inlyne.elv"
          "$inlyne_bin" --gen-completions fish       > "$comp_out/inlyne.fish"
          "$inlyne_bin" --gen-completions powershell > "$comp_out/inlyne.ps1"
          "$inlyne_bin" --gen-completions zsh        > "$comp_out/_inlyne"
        fi

        if [ "${{ matrix.os }}" = "windows-latest" ]; then
          7z a "$staging.zip" "$staging"
          echo "ASSET=$staging.zip" >> $GITHUB_ENV
        else
          tar czf "$staging.tar.gz" "$staging"
          echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
        fi

    - name: Upload binaries to release
      uses: svenstaro/upload-release-action@v1-release
      with:
        repo_token: ${{ secrets.GITHUB_TOKEN }}
        file: ${{ env.ASSET }}
        asset_name: ${{ env.ASSET }}
        tag: ${{ github.ref }}