vika-cli 1.4.0

Generate TypeScript types, Zod schemas, and Fetch-based API clients from OpenAPI/Swagger specifications
Documentation
name: Release

on:
  push:
    tags:
      - 'v*'

env:
  CARGO_TERM_COLOR: always

jobs:
  release:
    name: Build and Release
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
            binary_name: vika-cli-linux-x86_64
            asset_name: vika-cli-linux-x86_64
          - os: macos-latest
            target: x86_64-apple-darwin
            binary_name: vika-cli-macos-x86_64
            asset_name: vika-cli-macos-x86_64
          - os: macos-latest
            target: aarch64-apple-darwin
            binary_name: vika-cli-macos-arm64
            asset_name: vika-cli-macos-arm64
          - os: windows-latest
            target: x86_64-pc-windows-msvc
            binary_name: vika-cli.exe
            asset_name: vika-cli-windows-x86_64.exe

    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}

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

      - name: Prepare binary
        shell: bash
        run: |
          if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
            cp target/${{ matrix.target }}/release/vika-cli.exe ${{ matrix.asset_name }}
          else
            cp target/${{ matrix.target }}/release/vika-cli ${{ matrix.asset_name }}
            chmod +x ${{ matrix.asset_name }}
          fi

      - name: Generate checksum
        shell: bash
        run: |
          if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
            certutil -hashfile ${{ matrix.asset_name }} SHA256 > ${{ matrix.asset_name }}.sha256
          else
            shasum -a 256 ${{ matrix.asset_name }} > ${{ matrix.asset_name }}.sha256
          fi

      - name: Upload artifacts
        uses: actions/upload-artifact@v4
        with:
          name: ${{ matrix.asset_name }}
          path: |
            ${{ matrix.asset_name }}
            ${{ matrix.asset_name }}.sha256

  create-release:
    name: Create Release
    needs: release
    runs-on: ubuntu-latest
    permissions:
      contents: write
      actions: read
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Download all artifacts
        uses: actions/download-artifact@v4
        with:
          path: artifacts

      - name: Extract version from tag
        id: tag
        run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT

      - name: Prepare release files
        run: |
          # Move all artifacts to a single directory
          mkdir -p release-assets
          find artifacts -type f -exec cp {} release-assets/ \;
          
          # Copy install scripts to release assets
          cp install.sh release-assets/
          cp install.ps1 release-assets/
          
          # Make install scripts executable
          chmod +x release-assets/install.sh
          
          ls -la release-assets/

      - name: Create Release
        uses: softprops/action-gh-release@v1
        with:
          files: release-assets/*
          name: Release ${{ steps.tag.outputs.VERSION }}
          body: |
            ## Changes

            See [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md) for details.

            ## Installation

            ### macOS / Linux
            ```bash
            curl -fsSL https://github.com/${{ github.repository }}/releases/latest/download/install.sh | sh
            ```

            ### Windows (PowerShell)
            ```powershell
            irm https://github.com/${{ github.repository }}/releases/latest/download/install.ps1 | iex
            ```

            ### Cargo
            ```bash
            cargo install vika-cli
            ```
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}