Update README.md #36
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-CI | |
on: | |
push: | |
branches: [ "main" ] | |
tags: | |
- v*.*.* | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build | |
run: cargo build --verbose | |
- name: Run tests | |
run: cargo test --verbose | |
release: | |
name: Release | |
needs: [test] | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ${{ matrix.platform.os }} | |
strategy: | |
matrix: | |
platform: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
name: kelp-linux-x86_64.tar.gz | |
bin: kelp | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
name: kelp-windows-x86_64.7z | |
bin: kelp.exe | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Cache cargo & target directories | |
uses: Swatinem/[email protected] | |
- name: Build binary | |
uses: houseabsolute/actions-rust-cross@v0 | |
with: | |
command: "build" | |
args: --release | |
target: ${{ matrix.platform.target }} | |
toolchain: stable | |
- name: Package as archive | |
shell: bash | |
run: | | |
mkdir -p release/ | |
cd target/${{ matrix.platform.target }}/release | |
if [[ "${{ matrix.platform.os }}" == "windows-latest" ]]; then | |
7z a ../../../release/${{ matrix.platform.name }} ${{ matrix.platform.bin }} | |
else | |
tar czvf ../../../release/${{ matrix.platform.name }} ${{ matrix.platform.bin }} | |
fi | |
cd - | |
- name: Generate sha256sum | |
shell: bash | |
run: | | |
cd release | |
sha256sum ${{ matrix.platform.name }} > ${{ matrix.platform.name }}.sha256 | |
cd - | |
- name: Publish GitHub release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
release/${{ matrix.platform.name }} | |
release/${{ matrix.platform.name }}.sha256 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
permissions: | |
contents: write | |