clipivot 0.3.5

A command-line tool for quickly generating pivot tables.
Documentation
# from https://github.com/paskausks/rust-bin-github-workflows
on:
  push:
    # Sequence of patterns matched against refs/tags
    tags:
      - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Create Release

env:
  # Could, potentially automatically parse
  # the bin name, but let's do it automatically for now.
  RELEASE_BIN: clipivot

  # Space separated paths to include in the archive.
  # Start relative paths with a dot if you don't want
  # paths to be preserved. Use "/" as a delimiter.
  # adapted from source to replace license file with my two licenses
  RELEASE_ADDS: README.md LICENSE-APACHE LICENSE-MIT


jobs:
  build:
    name: Build release

    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        build: [linux, macos, windows]
        include:
          - build: linux
            os: ubuntu-latest
            rust: stable
          - build: macos
            os: macos-latest
            rust: stable
          - build: windows
            os: windows-latest
            rust: stable

    steps:
    - uses: actions/checkout@v1

    - name: Install Rust (rustup)
      run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }}
      shell: bash

    - name: Build
      run: cargo build --verbose --release

    - name: Create artifact directory
      run: mkdir artifacts

    - name: Create archive for Linux
      run: 7z a -ttar -so -an ./target/release/${{ env.RELEASE_BIN }} ${{ env.RELEASE_ADDS }} | 7z a -si ./artifacts/${{ env.RELEASE_BIN }}-linux-x86_64.tar.gz
      if: matrix.os == 'ubuntu-latest'

    - name: Create archive for Windows
      run: 7z a -tzip ./artifacts/${{ env.RELEASE_BIN }}-windows-x86_64.zip ./target/release/${{ env.RELEASE_BIN }}.exe ${{ env.RELEASE_ADDS }}
      if: matrix.os == 'windows-latest'

    - name: Install p7zip
      # 7Zip not available on MacOS, install p7zip via homebrew.
      run: brew install p7zip
      if: matrix.os == 'macos-latest'

    - name: Create archive for MacOS
      run: 7z a -tzip ./artifacts/${{ env.RELEASE_BIN }}-mac-x86_64.zip ./target/release/${{ env.RELEASE_BIN }} ${{ env.RELEASE_ADDS }}
      if: matrix.os == 'macos-latest'

    # This will double-zip
    # See - https://github.com/actions/upload-artifact/issues/39
    - uses: actions/upload-artifact@v1
      name: Upload archive
      with:
        name: ${{ runner.os }}
        path: artifacts/
    - uses: ncipollo/release-action@v1
      name: Upload Release for Linux
      if: matrix.os == 'ubuntu-latest'
      with:
        artifact: ./artifacts/${{ env.RELEASE_BIN }}-linux-x86_64.tar.gz
        # following two args required because running parallel builds on different os
        allowUpdates: true
        replacesArtifacts: false
        # https://en.wikipedia.org/wiki/List_of_archive_formats
        artifactContentType: application/x-gzip
        token: ${{ secrets.GITHUB_TOKEN }}
    - uses: ncipollo/release-action@v1
      name: Upload Release for MacOS
      if: matrix.os == 'macos-latest'
      with:
        artifact: ./artifacts/${{ env.RELEASE_BIN }}-mac-x86_64.zip
        # following two args required because running parallel builds on different os
        allowUpdates: true
        replacesArtifacts: false
        # https://en.wikipedia.org/wiki/List_of_archive_formats
        artifactContentType: application/zip
        token: ${{ secrets.GITHUB_TOKEN }}
    - uses: ncipollo/release-action@v1
      name: Upload Release for Windows
      if: matrix.os == 'windows-latest'
      with:
        artifact: ./artifacts/${{ env.RELEASE_BIN }}-windows-x86_64.zip
        # following two args required because running parallel builds on different os
        allowUpdates: true
        replacesArtifacts: false
        # https://en.wikipedia.org/wiki/List_of_archive_formats
        artifactContentType: application/zip
        token: ${{ secrets.GITHUB_TOKEN }}