buklo 0.1.12

Buklo is a simple CLI HTTP client
name: release
on:
  push:
    branches: [main, staging, trying]
    tags: ["v[0-9]+.[0-9]+.[0-9]+"]
  pull_request:
    branches: [main]
#     branches-ignore:
#         - 'dependabot/**'
  workflow_dispatch:

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

          - os: windows-latest
            target: x86_64-pc-windows-msvc
          # - os: windows-latest
          #   target: aarch64-pc-windows-msvc
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: Set artifact name
        shell: bash
        run: |
          version="$(git describe --tags --match='v*.*.*' --always)"
          name="bulko-$version-${{ matrix.target }}"
          echo "ARTIFACT_NAME=$name" >> $GITHUB_ENV
          echo "version: $version"
          echo "artifact: $name"
      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable
          target: ${{ matrix.target }}
      
      - name: Init cache
        uses: Swatinem/rust-cache@a22603398250b864f7190077025cf752307154dc
      
      - name: Setup Mold
        uses: rui314/setup-mold@v1
        with:
          mold-version: 1.4.1
          make-default: false
    
      - name: Build binary
        uses: dtolnay/rust-toolchain@v1
        with:
          toolchain: stable
          components: rustfmt
      - name: Check formatting
        run: |
          cargo build --release --target=${{ matrix.target }} --color=always --verbose

      - name: Package (*nix)
        if: runner.os != 'Windows'
        run: >
          tar -cv
          LICENSE.md README.md
          -C target/${{ matrix.target }}/release/ buklo
          | gzip --best > '${{ env.ARTIFACT_NAME }}.tar.gz'
      - name: Package (Windows)
        if: runner.os == 'Windows'
        run: >
          7z a ${{ env.ARTIFACT_NAME }}.zip
          LICENSE.md README.md
          ./target/${{ matrix.target }}/release/buklo.exe
      - name: Upload artifact
        uses: actions/upload-artifact@v4
        with:
          name: ${{ matrix.target }}
          path: |
            *.zip
            *.tar.gz
      - name: Create release
        if: startsWith(github.ref, 'refs/tags/v')
        uses: softprops/action-gh-release@v1
        with:
          draft: false
          generate_release_notes: true
          discussion_category_name: 'release'
          files: |
            *.zip
            *.tar.gz