rough 0.2.0

A very simple and opinionated static site generator.
name: Build and Publish Binaries

on:
  push:
    tags:
    - 'v*'

jobs:
  build:
    name: Build for ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        name: [linux, windows, macos]

        include:
        - name: linux
          os: ubuntu-latest
          artifact_name: target/x86_64-unknown-linux-musl/release/rough
          asset_name: rough-linux
        - name: windows
          os: windows-latest
          artifact_name: target/release/rough.exe
          asset_name: rough-windows
        - name: macos
          os: macos-latest
          artifact_name: target/release/rough
          asset_name: rough-macos

    steps:
    - name: Checkout project
      uses: actions/checkout@v1

    - name: Set up rust
      if: runner.os != 'Linux'
      uses: actions-rs/toolchain@v1
      with:
        override: true
        toolchain: nightly

    - name: Set up rust
      if: runner.os == 'Linux'
      uses: actions-rs/toolchain@v1
      with:
        override: true
        toolchain: nightly
        target: x86_64-unknown-linux-musl

    - name: Build
      if: runner.os != 'Linux'
      run: cargo build --release --locked

    - name: Build
      if: runner.os == 'Linux'
      run: cargo build --release --locked --target x86_64-unknown-linux-musl

    - name: Upload binaries as artifacts
      uses: actions/upload-artifact@v2
      with:
        name: ${{ matrix.asset_name }}
        path: ${{ matrix.artifact_name }}

  publish:
    name: Publish artifacts as release
    runs-on: ubuntu-latest
    needs: build

    steps:
    - name: Download artifacts
      uses: actions/download-artifact@v2
      with:
        path: ./artifacts

    - name: Make POSIX artifacts executable
      run: |
        chmod +x ./artifacts/rough-linux/rough
        chmod +x ./artifacts/rough-macos/rough

    - name: Create release
      id: create_release
      uses: actions/create-release@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        tag_name: ${{ github.ref }}
        release_name: Release ${{ github.ref }}

    - name: Upload Linux artifacts to release
      uses: actions/upload-release-asset@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        upload_url: ${{ steps.create_release.outputs.upload_url }}
        asset_path: ./artifacts/rough-linux/rough
        asset_name: rough-linux
        asset_content_type: application/x-elf

    - name: Upload MacOS artifacts to release
      uses: actions/upload-release-asset@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        upload_url: ${{ steps.create_release.outputs.upload_url }}
        asset_path: ./artifacts/rough-macos/rough
        asset_name: rough-macos
        asset_content_type: application/x-mach-o

    - name: Upload Windows artifacts to release
      uses: actions/upload-release-asset@v1
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        upload_url: ${{ steps.create_release.outputs.upload_url }}
        asset_path: ./artifacts/rough-windows/rough.exe
        asset_name: rough.exe
        asset_content_type: application/x-msdownload