on:
push:
tags:
- 'v*'
name: Create Release
env:
RELEASE_BIN: clipivot
RELEASE_ADDS: README.md LICENSE-APACHE LICENSE-MIT
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 }}
shell: bash
- 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/
- uses: ncipollo/release-action@v1
name: Upload Release for Linux
if: matrix.os == 'ubuntu-latest'
with:
artifact: ./artifacts/${{ env.RELEASE_BIN }}-linux-x86_64.tar.gz
allowUpdates: true
replacesArtifacts: false
artifactContentType: application/x-gzip
token: ${{ secrets.GITHUB_TOKEN }}
- uses: ncipollo/release-action@v1
name: Upload Release for MacOS
if: matrix.os == 'macos-latest'
with:
artifact: ./artifacts/${{ env.RELEASE_BIN }}-mac-x86_64.zip
allowUpdates: true
replacesArtifacts: false
artifactContentType: application/zip
token: ${{ secrets.GITHUB_TOKEN }}
- uses: ncipollo/release-action@v1
name: Upload Release for Windows
if: matrix.os == 'windows-latest'
with:
artifact: ./artifacts/${{ env.RELEASE_BIN }}-windows-x86_64.zip
allowUpdates: true
replacesArtifacts: false
artifactContentType: application/zip
token: ${{ secrets.GITHUB_TOKEN }}