name: Release
on:
push:
branches:
- release
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
build:
name: Build Release
runs-on: ${{ matrix.os }}
strategy:
matrix:
toolchain: [1.52.0]
os: [ubuntu-20.04, macos-10.15, windows-2019]
include:
- platform: linux
os: ubuntu-20.04
features: z3,boolector
target: x86_64-unknown-linux-gnu
extension: ""
- platform: macos
os: macos-10.15
features: z3,boolector
target: x86_64-apple-darwin
extension: ""
- platform: windows
os: windows-2019
features: z3
target: x86_64-pc-windows-msvc
extension: ".exe"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust ${{ matrix.toolchain }}
uses: actions-rs/toolchain@v1
with:
profile: default
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.target }}
override: true
- name: Compute new Version
id: compute_version
uses: mathieudutour/github-tag-action@v5.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
release_branches: .*
dry_run: true
- name: Install Sed on Windows
if: ${{ contains(matrix.os, 'windows') }}
run: choco install sed -y
- name: Update Version in Manifest
shell: bash
run: |
${{ format('sed -i -e "s/^version[[:space:]]*=[[:space:]]*\"[[:digit:]]*.[[:digit:]]*.[[:digit:]]*\"/version = \"{0}\"/g" Cargo.toml', steps.compute_version.outputs.new_version) }}
- name: Update Lock File to New Manifest Version
uses: actions-rs/cargo@v1
with:
command: update
args: --package monster-rs
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.target }} --features ${{ matrix.features }} --locked
- name: Rename Binary
shell: bash
run: mv target/${{ matrix.target }}/release/monster${{ matrix.extension }} ./monster-${{ matrix.target }}${{ matrix.extension }}
- name: Upload Binary Artifact
uses: actions/upload-artifact@v2
with:
name: monster-${{ matrix.platform }}
path: monster-${{ matrix.target }}${{ matrix.extension }}
if-no-files-found: error
release:
name: Semantic Release
needs: build
environment: Release
runs-on: ubuntu-20.04
env:
GIT_AUTHOR_NAME: "Github Action"
GIT_AUTHOR_EMAIL: "action@github.com"
GIT_COMMITTER_NAME: "Github Action"
GIT_COMMITTER_EMAIL: "action@github.com"
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ssh-key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
fetch-depth: 0
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.52.0
override: true
- name: Install Semantic Release for Rust
uses: actions-rs/cargo@v1
with:
command: install
args: semantic-release-rust --version 1.0.0-alpha.8 --locked
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features --locked
- uses: actions/download-artifact@v2
with:
name: monster-linux
- uses: actions/download-artifact@v2
with:
name: monster-windows
- uses: actions/download-artifact@v2
with:
name: monster-macos
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
with:
semantic_version: 17.4.1
extra_plugins: |
@semantic-release/exec@5.0
@semantic-release/git@9.0
@saithodev/semantic-release-backmerge@1.2
semantic-release-slack-bot@2.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
SLACK_WEBHOOK: ${{ secrets.SEMANTIC_RELEASE_SLACK_WEBHOOK }}
publish-book:
name: Publish Book
environment: github-pages
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ssh-key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
- name: Install Graphviz
run: |
sudo apt-get update
sudo apt-get install -y graphviz
- name: Install mdbook and Dependencies
run: |
cargo install mdbook --locked || true
cargo install mdbook-linkcheck --locked || true
cargo install --git https://github.com/dylanowen/mdbook-graphviz || true
- name: Generate Book as Html
run: mdbook build book
- name: Deploy on Github Pages
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
publish_dir: ./book/book/html
user_name: "Github Action"
user_email: "action@github.com"