Update LICENSE #38
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: Main Workflow | |
on: | |
push: | |
branches: | |
- "**" | |
tags: | |
- "v0.*" | |
- "v1.*" | |
pull_request: | |
branches: | |
- "**" | |
jobs: | |
check_pkg: | |
name: Check Package | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
name: Clone repository | |
- name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- name: Check Package | |
uses: actions-rs/cargo@v1 | |
with: | |
command: check | |
test_pkg: | |
needs: [check_pkg] | |
name: Test Package | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
name: Clone repository | |
- name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- name: Test Package | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
lint_pkg: | |
needs: [check_pkg] | |
name: Lint Package | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
name: Clone repository | |
- name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
components: rustfmt, clippy | |
- name: Check Package Format | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
- name: Lint Package | |
uses: actions-rs/clippy-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
args: --all-features | |
crates_publish: | |
needs: [lint_pkg, test_pkg] | |
name: Publish Cargo Package | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
name: Clone repository | |
- name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: login | |
args: ${{ secrets.CRATES_IO_TOKEN }} | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: publish | |
github_release: | |
needs: [crates_publish] | |
name: Publish GitHub Release | |
if: startsWith(github.ref, 'refs/tags/') | |
strategy: | |
matrix: | |
rs_target: | |
- x86_64-unknown-linux-gnu | |
- x86_64-unknown-linux-musl | |
- x86_64-apple-darwin | |
- x86_64-pc-windows-msvc | |
include: | |
- rs_target: x86_64-unknown-linux-gnu | |
os: ubuntu-latest | |
pkg_name: tivilsta-x86_64-unknown-linux-gnu.tar.gz | |
- rs_target: x86_64-unknown-linux-musl | |
os: ubuntu-latest | |
pkg_name: tivilsta-x86_64-unknown-linux-musl.tar.gz | |
- rs_target: x86_64-apple-darwin | |
os: macOS-latest | |
pkg_name: tivilsta-x86_64-apple-darwin.tar.gz | |
- rs_target: x86_64-pc-windows-msvc | |
os: windows-latest | |
pkg_name: tivilsta-x86_64-pc-windows-msvc.zip | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
name: Clone repository | |
- name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
target: ${{ matrix.rs_target }} | |
- name: Install APT dependencies. | |
if: matrix.rs_target == 'x86_64-unknown-linux-musl' | |
run: | | |
sudo apt install -y musl-tools | |
- name: Build for target | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release --target ${{ matrix.rs_target }} | |
- name: Prepare build artifacts for Windows | |
if: matrix.os == 'windows-latest' | |
run: | | |
cd target/${{ matrix.rs_target }}/release | |
strip tivilsta.exe | |
7z a ../../../${{ matrix.pkg_name }} tivilsta.exe | |
cd - | |
- name: Prepare build artifacts for Mac/Linux | |
if: matrix.os != 'windows-latest' | |
run: | | |
cd target/${{ matrix.rs_target }}/release | |
strip tivilsta | |
tar czvf ../../../${{ matrix.pkg_name }} tivilsta | |
cd - | |
- name: Create Release Note | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
previousTag=$(git tag --sort=-creatordate | head -n 2 | tail -n 1) | |
if [[ -z "${previousTag}" ]] | |
then | |
git log --graph --decorate --pretty=format:"%h %d %s (@%aN)" > RELEASE.md | |
else | |
git log ${previousTag}..HEAD --graph --decorate --pretty=format:"%h %d %s (@%aN)" > RELEASE.md | |
fi | |
- name: Publish GitHub Release for ${{ matrix.rs_target }} | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: target/**/release/* | |
body_path: RELEASE.md |