Fix typo #43
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@v4 | |
name: Clone repository | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Check Package | |
run: cargo check | |
test_pkg: | |
needs: [check_pkg] | |
name: Test Package | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
name: Clone repository | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Test Package | |
run: cargo test --all-features | |
lint_pkg: | |
needs: [check_pkg] | |
name: Lint Package | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
name: Clone repository | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy, rustfmt | |
- name: Check Package Format | |
run: cargo fmt --all -- --check | |
- name: Lint Package | |
run: cargo clippy --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@v4 | |
name: Clone repository | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Login to crates.io | |
run: cargo login ${{ secrets.CRATES_IO_TOKEN }} | |
- name: Publish Package | |
run: cargo 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@v4 | |
name: Clone repository | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ 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 | |
run: cargo build --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 |