name: Release
on:
push:
tags:
- 'v*.*.*'
env:
TPE_HPO_BIN: 'tpe_hyperparameter_optm'
SERVING_BIN: 'serving'
EVALUATOR_BIN: 'evaluator'
RELEASE_NAME: 'Serenade'
WINDOWS_TARGET: x86_64-pc-windows-msvc.Zip
MACOS_TARGET: x86_64-apple-darwin.tar.gz
LINUX_AMD64_TARGET: x86_64-unknown-linux-musl.tar.gz
LINUX_ARM64_TARGET: aarch64-unknown-linux-musl.tar.gz
jobs:
linuxCI:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Get version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install latest rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
override: true
- name: Build
run: cargo build --all --release
- name: Test
run: cargo test
- name: Release binaries
shell: bash
run: |
cd target/release
tar czvf ../../${{ env.RELEASE_NAME }}-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_AMD64_TARGET }} ${{ env.TPE_HPO_BIN }} ${{ env.SERVING_BIN }} ${{ env.EVALUATOR_BIN }}
cd -
- name: Publish linux release
uses: softprops/action-gh-release@v1
with:
files: ${{ env.RELEASE_NAME }}-${{ steps.get_version.outputs.VERSION }}-${{ env.LINUX_AMD64_TARGET }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release crate
uses: katyo/publish-crates@v1
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
macCI:
if: startsWith(github.ref, 'refs/tags/')
runs-on: macos-latest
steps:
- name: Get version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install latest rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-apple-darwin
default: true
override: true
- name: Build
run: cargo build --all --release
- name: Release binaries
shell: bash
run: |
cd target/release
tar czvf ../../${{ env.RELEASE_NAME }}-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS_TARGET }} ${{ env.TPE_HPO_BIN }} ${{ env.SERVING_BIN }} ${{ env.EVALUATOR_BIN }}
cd -
- name: Publish mac release
uses: softprops/action-gh-release@v1
with:
files: ${{ env.RELEASE_NAME }}-${{ steps.get_version.outputs.VERSION }}-${{ env.MACOS_TARGET }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
winCI:
if: startsWith(github.ref, 'refs/tags/')
runs-on: windows-latest
steps:
- name: Install 7Zip PowerShell Module
shell: powershell
run: Install-Module 7Zip4PowerShell -Force -Verbose
- id: get_version
uses: battila7/get-version-action@v2
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install latest rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
override: true
- name: Build
run: cargo build --all --release
- name: Release binaries
shell: powershell
run: |
$compress = @{
Path = "D:\a\serenade\serenade\target\release\${{ env.TPE_HPO_BIN }}.exe", "D:\a\serenade\serenade\target\release\${{ env.SERVING_BIN }}.exe", "D:\a\serenade\serenade\target\release\${{ env.EVALUATOR_BIN }}.exe"
CompressionLevel = "Fastest"
DestinationPath = ".\${{ env.RELEASE_NAME }}-${{ steps.get_version.outputs.version }}-${{ env.WINDOWS_TARGET }}"
}
Compress-Archive @compress
- name: Publish win release
uses: softprops/action-gh-release@v1
with:
files: .\${{ env.RELEASE_NAME }}-${{ steps.get_version.outputs.version }}-${{ env.WINDOWS_TARGET }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}