Update rust.yml #20
Workflow file for this run
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 | |
on: | |
push: | |
tags: | |
- "v*" | |
permissions: | |
contents: write | |
jobs: | |
build_release: | |
strategy: | |
matrix: | |
target: | |
- x86_64-unknown-linux-musl | |
- x86_64-pc-windows-msvc | |
- x86_64-apple-darwin | |
include: | |
- target: x86_64-unknown-linux-musl | |
os: ubuntu-latest | |
- target: x86_64-pc-windows-msvc | |
os: windows-latest | |
- target: x86_64-apple-darwin | |
os: macos-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Install Cross | |
if: matrix.os == 'ubuntu-latest' | |
run: cargo install cross | |
- name: Build - windows | |
if: matrix.os == 'windows-latest' | |
run: cargo build --release --target ${{ matrix.target }} | |
- name: Build - linux | |
if: matrix.os == 'ubuntu-latest' | |
run: cross build --release --target ${{ matrix.target }} | |
- name: Build - macos | |
if: matrix.os == 'macos-latest' | |
run: cargo build --release --target ${{ matrix.target }} | |
- name: Strip binary (linux and macos) | |
if: matrix.build == 'linux' || matrix.build == 'macos' | |
run: strip "target/${{ matrix.target }}/release/iptv-checker-rs" | |
- name: Build archive | |
shell: bash | |
run: | | |
# Replace with the name of your binary | |
binary_name="iptv-checker-rs" | |
dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}" | |
mkdir "$dirname" | |
if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
mv "target/${{ matrix.target }}/release/$binary_name.exe" "$dirname" | |
else | |
mv "target/${{ matrix.target }}/release/$binary_name" "$dirname" | |
fi | |
if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
7z a "$dirname.zip" "$dirname" | |
echo "ASSET=$dirname.zip" >> $GITHUB_ENV | |
else | |
tar -czf "$dirname.tar.gz" "$dirname" | |
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV | |
fi | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
${{ env.ASSET }} |