futhorc 0.1.13

A static site generator to learn Rust and to build my personal blog
Documentation
name: Merge

on:
  push:
    branches: [ master ]
    # If `Cargo.toml` is the only file to change, it's probably because this
    # action bumped the version, and we don't want this action to trigger a new
    # run of itself creating an infinite loop of version bumps. To solve, we
    # ignore changes to `Cargo.toml` for the purposes of the merge-to-master
    # action.
    paths-ignore: ["Cargo.toml"]

env:
  CARGO_TERM_COLOR: always

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Install latest stable
      uses: actions-rs/toolchain@v1
      with:
        toolchain: stable
        override: true
        components: rustfmt, clippy
    - uses: Swatinem/rust-cache@v1 # must follow toolchain installation
    - name: Check
      uses: actions-rs/cargo@v1
      with:
        command: check
    - name: Lint
      run: cargo clippy -- --deny "warnings"

  docs:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Install latest stable
      uses: actions-rs/toolchain@v1
      with:
        toolchain: stable
        override: true
    - uses: Swatinem/rust-cache@v1 # must follow toolchain installation
    - run: cargo doc --verbose --features fail-on-warnings

  test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Install latest stable
      uses: actions-rs/toolchain@v1
      with:
        toolchain: stable
        override: true
    - uses: Swatinem/rust-cache@v1 # must follow toolchain installation
    - name: Run tests
      run: cargo test --verbose --features fail-on-warnings

  release:
    needs: [test, docs, check]

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Install latest stable
      uses: actions-rs/toolchain@v1
      with:
        toolchain: stable
        override: true
        components: rustfmt, clippy
    - uses: Swatinem/rust-cache@v1 # must follow toolchain installation
    - name: Bump version
      run: |
        set -eo pipefail
        echo "Installing cargo-bump"
        cargo install cargo-bump --verbose
        echo "Updating git identity"
        git config --global user.email "futhorc-merge-action@example.com"
        git config --global user.name "Futhorc Merge Action"
        echo "Bumping patch version"
        cargo bump patch --git-tag || true
        echo "Pushing git tags"
        git push
        git push --tags || true
    - name: build
      run: |
        set -eo pipefail
        cargo build --verbose --features fail-on-warnings --release
        version="v$(cargo metadata --format-version 1 | jq -r '.packages[] | select(.name == "futhorc") | .version')"
        mv target/release/futhorc futhorc-amd64-linux-$version
    - name: Pre-release
      uses: "marvinpinto/action-automatic-releases@latest"
      with:
        repo_token: "${{ secrets.GITHUB_TOKEN }}"
        automatic_release_tag: "latest"
        prerelease: true
        title: "Development Build"
        files: futhorc-amd64-linux-*
    - name: Publish
      env:
        CARGO_TOKEN: ${{ secrets.CARGO_TOKEN }}
      run: cargo login $CARGO_TOKEN && cargo publish --allow-dirty