ci: add cd workflow

This commit is contained in:
Dmitriy Pleshevskiy 2022-02-28 14:58:13 +03:00
parent 5d543156c8
commit a78b0dd742
2 changed files with 71 additions and 0 deletions

46
.github/workflows/cd.yml vendored Normal file
View File

@ -0,0 +1,46 @@
name: CD
on:
release:
types: [published]
jobs:
deploy:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: clippy
- name: Build
run: make build
- name: Build Release Mac
if: matrix.os == 'macos-latest'
run: make release-mac
- name: Build Release Linux
if: matrix.os == 'ubuntu-latest'
run: make release-linux
- name: Build Release Win
if: matrix.os == 'windows-latest'
run: make release-win
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
./release/*.tar.gz
./release/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

25
makefile Normal file
View File

@ -0,0 +1,25 @@
build:
cargo build --release
install:
cargo install --path .
uninstall:
cargo uninstall hwt_ui
clean:
cargo clean
release-mac:
strip target/release/hwt
mkdir -p release
tar -C ./target/release/ -czvf ./release/hwt-mac.tar.gz ./hwt
release-win:
mkdir -p release
tar -C ./target/release/ -czvf ./release/hwt-win.tar.gz ./hwt.exe
release-linux:
strip target/release/hwt
mkdir -p release
tar -C ./target/release/ -czvf ./release/hwt-linux.tar.gz ./hwt