plexos2duckdb 0.1.3

A tool to convert PLEXOS Solution files to a DuckDB database.
Documentation
name: Release

on:
  # push:
  #   tags:
  #     - "v*"
  workflow_dispatch:
    inputs:
      tag:
        description: "Tag to build (e.g., v1.2.3)"
        required: false
        type: string

permissions:
  contents: write

env:
  APP_NAME: plexos2duckdb
  # Prefer the dispatch input; otherwise use the tag that triggered the workflow
  TAG: ${{ inputs.tag != '' && inputs.tag || github.ref_name }}
  # Fully-qualified ref for actions that need it
  REF: ${{ inputs.tag != '' && format('refs/tags/{0}', inputs.tag) || github.ref }}

jobs:
  create-release:
    name: Create Release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          ref: ${{ env.REF }}

      # Creates the GitHub Release for the tag if it doesn't exist yet
      - name: Create GitHub Release
        uses: taiki-e/create-gh-release-action@v1
        with:
          # You can add: changelog: CHANGELOG.md  (optional)
          token: ${{ secrets.GITHUB_TOKEN }}
          ref: ${{ env.REF }}

  upload-binaries:
    name: Build & Upload ${{ matrix.name }}
    needs: [create-release]
    strategy:
      fail-fast: false
      matrix:
        include:
          - name: linux-gnu
            os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
            archive_suffix: linux-x86_64

          - name: macos-arm64
            os: macos-14
            target: aarch64-apple-darwin
            archive_suffix: macos-aarch64

          - name: macos-x86_64
            os: macos-13
            target: x86_64-apple-darwin
            archive_suffix: macos-x86_64

          - name: windows-x86_64
            os: windows-latest
            target: x86_64-pc-windows-msvc
            archive_suffix: windows-x86_64

    runs-on: ${{ matrix.os }}
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          ref: ${{ env.REF }}

      - name: Install Rust (stable)
        uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}

      - name: Upload rust binary to GitHub Release
        uses: taiki-e/upload-rust-binary-action@v1
        with:
          bin: ${{ env.APP_NAME }}
          token: ${{ secrets.GITHUB_TOKEN }}
          target: ${{ matrix.target }}
          archive: $bin-$tag-${{ matrix.archive_suffix }}
          checksum: sha256
          locked: true
          ref: ${{ env.REF }}
          include: LICENSE,README.md
          leading-dir: true