修改自动构建,修复少量bug
Some checks failed
Release / Publish to Github Releases (, macos-latest, aarch64-apple-darwin, true) (push) Has been cancelled
Release / Publish to Github Releases (, macos-latest, x86_64-apple-darwin) (push) Has been cancelled
Release / Publish to Github Releases (, ubuntu-latest, aarch64-unknown-linux-musl, true) (push) Has been cancelled
Release / Publish to Github Releases (, ubuntu-latest, arm-unknown-linux-musleabihf, true) (push) Has been cancelled
Release / Publish to Github Releases (, ubuntu-latest, armv7-unknown-linux-musleabihf, true) (push) Has been cancelled
Release / Publish to Github Releases (, ubuntu-latest, i686-unknown-linux-musl, true) (push) Has been cancelled
Release / Publish to Github Releases (, ubuntu-latest, x86_64-unknown-linux-musl, true) (push) Has been cancelled
Release / Publish to Github Releases (, windows-latest, aarch64-pc-windows-msvc, true) (push) Has been cancelled
Release / Publish to Github Releases (, windows-latest, i686-pc-windows-msvc, true) (push) Has been cancelled
Release / Publish to Github Releases (, windows-latest, x86_64-pc-windows-msvc) (push) Has been cancelled
Some checks failed
Release / Publish to Github Releases (, macos-latest, aarch64-apple-darwin, true) (push) Has been cancelled
Release / Publish to Github Releases (, macos-latest, x86_64-apple-darwin) (push) Has been cancelled
Release / Publish to Github Releases (, ubuntu-latest, aarch64-unknown-linux-musl, true) (push) Has been cancelled
Release / Publish to Github Releases (, ubuntu-latest, arm-unknown-linux-musleabihf, true) (push) Has been cancelled
Release / Publish to Github Releases (, ubuntu-latest, armv7-unknown-linux-musleabihf, true) (push) Has been cancelled
Release / Publish to Github Releases (, ubuntu-latest, i686-unknown-linux-musl, true) (push) Has been cancelled
Release / Publish to Github Releases (, ubuntu-latest, x86_64-unknown-linux-musl, true) (push) Has been cancelled
Release / Publish to Github Releases (, windows-latest, aarch64-pc-windows-msvc, true) (push) Has been cancelled
Release / Publish to Github Releases (, windows-latest, i686-pc-windows-msvc, true) (push) Has been cancelled
Release / Publish to Github Releases (, windows-latest, x86_64-pc-windows-msvc) (push) Has been cancelled
This commit is contained in:
194
.github/workflows/build.yml
vendored
194
.github/workflows/build.yml
vendored
@ -1,78 +1,140 @@
|
|||||||
name: build
|
|
||||||
|
name: Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- "v*.*.*"
|
- v[0-9]+.[0-9]+.[0-9]+*
|
||||||
workflow_dispatch: {}
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
release:
|
||||||
name: build
|
name: Publish to Github Releases
|
||||||
runs-on: ${{ matrix.os }}
|
permissions:
|
||||||
|
contents: write
|
||||||
|
outputs:
|
||||||
|
rc: ${{ steps.check-tag.outputs.rc }}
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
build: [linux, macos, windows]
|
|
||||||
include:
|
include:
|
||||||
- build: linux
|
- target: aarch64-unknown-linux-musl
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
rust: stable
|
use-cross: true
|
||||||
target: x86_64-unknown-linux-musl
|
cargo-flags: ""
|
||||||
archive-name: ncmmiao-linux.tar.gz
|
- target: aarch64-apple-darwin
|
||||||
- build: macos
|
os: macos-latest
|
||||||
os: macos-latest
|
use-cross: true
|
||||||
rust: stable
|
cargo-flags: ""
|
||||||
target: x86_64-apple-darwin
|
- target: aarch64-pc-windows-msvc
|
||||||
archive-name: ncmmiao-macos.tar.gz
|
os: windows-latest
|
||||||
- build: windows
|
use-cross: true
|
||||||
os: windows-latest
|
cargo-flags: ""
|
||||||
rust: stable-x86_64-msvc
|
- target: x86_64-apple-darwin
|
||||||
target: x86_64-pc-windows-msvc
|
os: macos-latest
|
||||||
archive-name: ncmmiao-windows.7z
|
cargo-flags: ""
|
||||||
fail-fast: false
|
- target: x86_64-pc-windows-msvc
|
||||||
|
os: windows-latest
|
||||||
|
cargo-flags: ""
|
||||||
|
- target: x86_64-unknown-linux-musl
|
||||||
|
os: ubuntu-latest
|
||||||
|
use-cross: true
|
||||||
|
cargo-flags: ""
|
||||||
|
- target: i686-unknown-linux-musl
|
||||||
|
os: ubuntu-latest
|
||||||
|
use-cross: true
|
||||||
|
cargo-flags: ""
|
||||||
|
- target: i686-pc-windows-msvc
|
||||||
|
os: windows-latest
|
||||||
|
use-cross: true
|
||||||
|
cargo-flags: ""
|
||||||
|
- target: armv7-unknown-linux-musleabihf
|
||||||
|
os: ubuntu-latest
|
||||||
|
use-cross: true
|
||||||
|
cargo-flags: ""
|
||||||
|
- target: arm-unknown-linux-musleabihf
|
||||||
|
os: ubuntu-latest
|
||||||
|
use-cross: true
|
||||||
|
cargo-flags: ""
|
||||||
|
|
||||||
|
runs-on: ${{matrix.os}}
|
||||||
|
env:
|
||||||
|
BUILD_CMD: cargo
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v4.2.2
|
|
||||||
|
|
||||||
- name: Install Rust
|
- name: Check Tag
|
||||||
uses: actions-rs/toolchain@v1
|
id: check-tag
|
||||||
with:
|
shell: bash
|
||||||
toolchain: ${{ matrix.rust }}
|
run: |
|
||||||
profile: minimal
|
ver=${GITHUB_REF##*/}
|
||||||
override: true
|
echo "version=$ver" >> $GITHUB_OUTPUT
|
||||||
components: rustfmt, clippy
|
if [[ "$ver" =~ [0-9]+.[0-9]+.[0-9]+$ ]]; then
|
||||||
target: ${{ matrix.target }}
|
echo "rc=false" >> $GITHUB_OUTPUT
|
||||||
- name: Test
|
else
|
||||||
run: cargo test
|
echo "rc=true" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
- name: Install Rust Toolchain Components
|
||||||
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
with:
|
||||||
|
targets: ${{ matrix.target }}
|
||||||
|
|
||||||
- name: Build binary
|
- name: Install cross
|
||||||
run: cargo build --verbose --release --target ${{ matrix.target }}
|
if: matrix.use-cross
|
||||||
env:
|
uses: taiki-e/install-action@v2
|
||||||
RUST_BACKTRACE: 1
|
with:
|
||||||
|
tool: cross
|
||||||
|
|
||||||
- name: Strip binary (linux and macos)
|
- name: Overwrite build command env variable
|
||||||
if: matrix.build == 'linux' || matrix.build == 'macos'
|
if: matrix.use-cross
|
||||||
run: strip "target/${{ matrix.target }}/release/ncmmiao"
|
shell: bash
|
||||||
|
run: echo "BUILD_CMD=cross" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Show Version Information (Rust, cargo, GCC)
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
gcc --version || true
|
||||||
|
rustup -V
|
||||||
|
rustup toolchain list
|
||||||
|
rustup default
|
||||||
|
cargo -V
|
||||||
|
rustc -V
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
shell: bash
|
||||||
|
run: $BUILD_CMD build --locked --release --target=${{ matrix.target }} ${{ matrix.cargo-flags }}
|
||||||
|
|
||||||
- name: Build archive
|
- name: Build Archive
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
id: package
|
||||||
mkdir archive
|
env:
|
||||||
# cp LICENSE README.md archive/
|
target: ${{ matrix.target }}
|
||||||
cp README.md archive/
|
version: ${{ steps.check-tag.outputs.version }}
|
||||||
cd archive
|
run: |
|
||||||
if [ "${{ matrix.build }}" = "windows" ]; then
|
set -euxo pipefail
|
||||||
cp "../target/${{ matrix.target }}/release/ncmmiao.exe" ./
|
bin=${GITHUB_REPOSITORY##*/}
|
||||||
# 7z a "${{ matrix.archive-name }}" LICENSE README.md ncmmiao.exe
|
dist_dir=`pwd`/dist
|
||||||
7z a "${{ matrix.archive-name }}" README.md ncmmiao.exe
|
name=$bin-$version-$target
|
||||||
else
|
executable=target/$target/release/$bin
|
||||||
cp "../target/${{ matrix.target }}/release/ncmmiao" ./
|
if [[ "$RUNNER_OS" == "Windows" ]]; then
|
||||||
# tar -czf "${{ matrix.archive-name }}" LICENSE README.md ncmmiao
|
executable=$executable.exe
|
||||||
tar -czf "${{ matrix.archive-name }}" README.md ncmmiao
|
fi
|
||||||
fi
|
mkdir $dist_dir
|
||||||
- name: Release archive
|
cp $executable $dist_dir
|
||||||
uses: softprops/action-gh-release@v2
|
cd $dist_dir
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if [[ "$RUNNER_OS" == "Windows" ]]; then
|
||||||
with:
|
archive=$dist_dir/$name.zip
|
||||||
# name: ${{ matrix.archive-name }}
|
7z a $archive *
|
||||||
files: archive/${{ matrix.archive-name }}
|
echo "archive=dist/$name.zip" >> $GITHUB_OUTPUT
|
||||||
token: ${{ secrets.TOKEN }}
|
else
|
||||||
|
archive=$dist_dir/$name.tar.gz
|
||||||
|
tar -czf $archive *
|
||||||
|
echo "archive=dist/$name.tar.gz" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
- name: Publish Archive
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||||
|
with:
|
||||||
|
draft: false
|
||||||
|
files: ${{ steps.package.outputs.archive }}
|
||||||
|
prerelease: ${{ steps.check-tag.outputs.rc == 'true' }}
|
||||||
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -799,7 +799,7 @@ checksum = "07dcca13d1740c0a665f77104803360da0bdb3323ecce2e93fa2c959a6d52806"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ncmmiao"
|
name = "ncmmiao"
|
||||||
version = "2.2.5"
|
version = "2.2.6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes",
|
"aes",
|
||||||
"audiotags",
|
"audiotags",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ncmmiao"
|
name = "ncmmiao"
|
||||||
version = "2.2.5"
|
version = "2.2.6"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|||||||
@ -5,7 +5,7 @@ use clap::Parser;
|
|||||||
#[command(author = "lkhsss")]
|
#[command(author = "lkhsss")]
|
||||||
#[command(version,about = "一个解密ncm文件的神秘程序", long_about = None)]
|
#[command(version,about = "一个解密ncm文件的神秘程序", long_about = None)]
|
||||||
pub struct Cli {
|
pub struct Cli {
|
||||||
/// 最大线程数 约束逻辑在主函数
|
/// 并发的最大线程数,默认为4线程
|
||||||
#[arg(short, long)]
|
#[arg(short, long)]
|
||||||
pub workers: Option<usize>,
|
pub workers: Option<usize>,
|
||||||
/// 需要解密的文件夹或文件
|
/// 需要解密的文件夹或文件
|
||||||
|
|||||||
@ -71,10 +71,11 @@ fn main() {
|
|||||||
}
|
}
|
||||||
let taskcount = undumpfile.len();
|
let taskcount = undumpfile.len();
|
||||||
if taskcount == 0 {
|
if taskcount == 0 {
|
||||||
error!("没有找到有效文件")
|
error!("没有找到有效文件。使用-i参数输入需要解密的文件或文件夹。")
|
||||||
} else {
|
} else {
|
||||||
// 初始化线程池
|
// 初始化线程池
|
||||||
let pool = threadpool::Pool::new(max_workers);
|
let pool = threadpool::Pool::new(max_workers);
|
||||||
|
info!("启用{}线程",max_workers);
|
||||||
|
|
||||||
for filepath in undumpfile {
|
for filepath in undumpfile {
|
||||||
let output = outputdir.clone();
|
let output = outputdir.clone();
|
||||||
|
|||||||
Reference in New Issue
Block a user