Skip to content

Commit

Permalink
opt code
Browse files Browse the repository at this point in the history
  • Loading branch information
zangmiao committed Feb 24, 2024
0 parents commit 5a09d4a
Show file tree
Hide file tree
Showing 6 changed files with 1,626 additions and 0 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
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="ffmpeg-tool-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 }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/target
*.MOV
.idea
.vscode
Loading

0 comments on commit 5a09d4a

Please sign in to comment.