on:
push:
tags:
- 'v*'
name: Create Release
env:
RELEASE_BIN: morty
RELEASE_ADDS: README.md LICENSE
jobs:
build:
name: Build release
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [macos, windows]
include:
- 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 }}
if: matrix.os != 'macos-latest'
shell: bash
- name: Install Rust (macos)
run: |
curl https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
if: matrix.os == 'macos-latest'
- name: Build
run: cargo build --verbose --release
- name: Create artifact directory
run: mkdir artifacts
- 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
run: brew install p7zip
if: matrix.os == 'macos-latest'
- name: Create archive for MacOS
run: 7z a -tzip ./artifacts/${{ env.RELEASE_BIN }}-osx-x86_64.zip ./target/release/${{ env.RELEASE_BIN }} ${{ env.RELEASE_ADDS }}
if: matrix.os == 'macos-latest'
- name: Release Native
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ./artifacts/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
linux:
name: Build release
strategy:
matrix:
container:
- 'ubuntu:18.04'
- 'centos:7'
- 'centos:8' runs-on: ubuntu-latest
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v1
- name: Install Environment
run: |
apt-get update
apt-get install -y build-essential curl p7zip-full
if: contains( matrix.container, 'ubuntu' )
- name: Install Environment
run: |
yum -y groupinstall 'Development Tools'
yum install -y epel-release
yum install -y p7zip
if: contains( matrix.container, 'centos' )
- name: Install Rust (rustup)
run: |
curl https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
shell: bash
- name: Build
run: cargo build --verbose --release
- name: Create artifact directory
run: mkdir artifacts
- name: Create archive for Linux
run: 7za a -ttar -so -an ./target/release/${{ env.RELEASE_BIN }} ${{ env.RELEASE_ADDS }} | 7za a -si ./artifacts/${{ env.RELEASE_BIN }}-${{ matrix.container }}-x86_64.tar.gz
- name: Release Linux
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ./artifacts/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}