on:
workflow_dispatch:
push:
tags:
- 'v*'
name: Create Release
env:
RELEASE_BIN: crypt4gh
RELEASE_ADDS: README.md LICENSE
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 }}
if: matrix.os != 'macos-latest'
shell: bash
- name: Install Rust (macos)
run: |
curl https://sh.rustup.rs | sh -s -- -y
if: matrix.os == 'macos-latest'
- 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
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'
- uses: actions/upload-artifact@v1
name: Upload archive
with:
name: ${{ runner.os }}
path: artifacts/