weathr 1.2.2

A terminal-based ASCII weather application with animated scenes driven by real-time weather data
Documentation
name: Release

on:
  push:
    tags:
      - 'v*'
  workflow_dispatch:

permissions:
  contents: write

jobs:
  build-release:
    name: Build Release
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
            artifact_name: weathr
            asset_name: weathr-linux-amd64
          - os: macos-latest
            target: x86_64-apple-darwin
            artifact_name: weathr
            asset_name: weathr-macos-amd64
          - os: windows-latest
            target: x86_64-pc-windows-msvc
            artifact_name: weathr.exe
            asset_name: weathr-windows-amd64.exe

    steps:
      - uses: actions/checkout@v6
      
      - uses: dtolnay/rust-toolchain@v1
        with:
          toolchain: stable
          targets: ${{ matrix.target }}
          
      - uses: Swatinem/rust-cache@v2

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

      - name: Prepare Asset
        shell: bash
        run: |
          cd target/${{ matrix.target }}/release
          cp ${{ matrix.artifact_name }} ../../../${{ matrix.asset_name }}

      - name: Upload Release Asset
        uses: softprops/action-gh-release@v2
        if: startsWith(github.ref, 'refs/tags/')
        with:
          files: ${{ matrix.asset_name }}

  publish-crate:
    name: Publish to crates.io
    runs-on: ubuntu-latest
    if: startsWith(github.ref, 'refs/tags/')
    steps:
      - uses: actions/checkout@v6

      - uses: dtolnay/rust-toolchain@v1
        with:
          toolchain: stable

      - name: Publish
        run: cargo publish --token ${{ secrets.CARGO_TOKEN }}