Merge pull request #3 from okaneco/palette-update #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust CD | |
on: | |
push: | |
tags: | |
- "*.*.*" | |
jobs: | |
publish-binary: | |
runs-on: ${{ matrix.platform.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- os: macos-latest | |
os-name: macos | |
target: x86_64-apple-darwin | |
architecture: x86_64 | |
binary-postfix: "" | |
- os: ubuntu-latest | |
os-name: linux | |
target: x86_64-unknown-linux-gnu | |
architecture: x86_64 | |
binary-postfix: "" | |
- os: windows-latest | |
os-name: windows | |
target: x86_64-pc-windows-msvc | |
architecture: x86_64 | |
binary-postfix: ".exe" | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Cargo build | |
uses: dtolnay/rust-toolchain@stable | |
run: cargo build -v --release --target ${{ matrix.platform.target }} | |
- name: Package final binary | |
shell: bash | |
run: | | |
cd target/${{ matrix.platform.target }}/release | |
BINARY_NAME=simple_clustering${{ matrix.platform.binary-postfix }} | |
########## create tar.gz ########## | |
RELEASE_NAME=simple_clustering-${GITHUB_REF/refs\/tags\//}-${{ matrix.platform.os-name }}-${{ matrix.platform.architecture }} | |
tar czvf $RELEASE_NAME.tar.gz $BINARY_NAME | |
########## create sha256 ########## | |
if [[ ${{ runner.os }} == 'Windows' ]]; then | |
certutil -hashfile $RELEASE_NAME.tar.gz sha256 | grep -E [A-Fa-f0-9]{64} > $RELEASE_NAME.sha256 | |
else | |
shasum -a 256 $RELEASE_NAME.tar.gz > $RELEASE_NAME.sha256 | |
fi | |
- name: Releasing assets | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
target/${{ matrix.platform.target }}/release/simple_clustering-*.tar.gz | |
target/${{ matrix.platform.target }}/release/simple_clustering-*.sha256 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |