Skip to content

Update rust.yml

Update rust.yml #20

Workflow file for this run

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 }}