name: Release
on:
  push:
    tags:
      - 'v*'

jobs:
  release:
    runs-on: macos-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      
      - name: Setup Rust
        uses: actions-rust-lang/setup-rust-toolchain@v1
        with:
          toolchain: stable
      
      - name: Build release
        run: cargo build --release
      
      - name: Create archive
        run: |
          cd target/release
          tar -czf markbase-${{ github.ref_name }}-macos-arm64.tar.gz markbase
      
      - name: Upload release asset
        uses: actions/upload-artifact@v3
        with:
          name: markbase-${{ github.ref_name }}-macos-arm64
          path: target/release/markbase-${{ github.ref_name }}-macos-arm64.tar.gz