neyuki 0.6.3

A small Lua-like scripting language implemented in Rust
name: Release

on:
  push:
    tags: ['v*']
  workflow_dispatch:

permissions:
  contents: read

env:
  CARGO_TERM_COLOR: always

jobs:
  build:
    name: ${{ matrix.target }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          # 22.04 rather than latest: the binary links the runner's glibc and
          # libssl, so an older base runs on more distros.
          - { os: ubuntu-22.04,     target: x86_64-unknown-linux-gnu }
          - { os: ubuntu-22.04-arm, target: aarch64-unknown-linux-gnu }
          # macos-latest is Apple Silicon; the Apple SDK there also targets x86_64.
          - { os: macos-latest,     target: aarch64-apple-darwin }
          - { os: macos-latest,     target: x86_64-apple-darwin }
          # MSVC ships an ARM64 cross toolchain, so both build on the x64 runner.
          - { os: windows-latest,   target: x86_64-pc-windows-msvc }
          - { os: windows-latest,   target: aarch64-pc-windows-msvc }
    steps:
      - uses: actions/checkout@v4
      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}
      - name: Cache cargo
        uses: Swatinem/rust-cache@v2
        with:
          key: ${{ matrix.target }}
      - name: Install webview system libraries
        if: runner.os == 'Linux'
        run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libwebkit2gtk-4.1-dev libgtk-3-dev libsoup-3.0-dev
      - name: Build
        run: cargo build --release --target ${{ matrix.target }}
      - name: Package
        shell: bash
        run: |

          name=neyuki-${GITHUB_REF_NAME}-${{ matrix.target }}
          mkdir "$name"
          cp LICENSE README.md "$name/"
          if [[ "${{ matrix.target }}" == *windows* ]]; then
            cp target/${{ matrix.target }}/release/neyuki.exe "$name/"
            7z a "$name.zip" "$name"
          else
            cp target/${{ matrix.target }}/release/neyuki "$name/"
            tar czf "$name.tar.gz" "$name"
          fi
      - uses: actions/upload-artifact@v4
        with:
          name: neyuki-${{ matrix.target }}
          path: |

            neyuki-*.tar.gz
            neyuki-*.zip

  release:
    name: Publish release
    needs: build
    if: startsWith(github.ref, 'refs/tags/')
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/download-artifact@v4
        with:
          path: artifacts
          merge-multiple: true
      # Publish the draft by hand after review. Don't pre-create the release
      # in the UI: the action appends generated notes to an existing release,
      # duplicating them.
      - uses: softprops/action-gh-release@v2
        with:
          files: artifacts/*
          draft: true
          generate_release_notes: true