6 Commits

Author SHA1 Message Date
fc1729df7d 修改自动构建,修复少量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
2024-11-17 10:38:38 +08:00
1124cec79e 增加token 2024-11-17 09:42:59 +08:00
da9899d491 测试自动构建 2024-11-17 09:36:11 +08:00
224d18740f 修改自动构建
Some checks failed
build / build (ncmmiao-linux.tar.gz, linux, ubuntu-latest, stable, x86_64-unknown-linux-musl) (push) Has been cancelled
build / build (ncmmiao-macos.tar.gz, macos, macos-latest, stable, x86_64-apple-darwin) (push) Has been cancelled
build / build (ncmmiao-windows.7z, windows, windows-latest, stable-x86_64-msvc, x86_64-pc-windows-msvc) (push) Has been cancelled
2024-11-17 09:34:55 +08:00
f3de089067 测试自动构建 2024-11-17 09:22:53 +08:00
4137752c49 更改自动构建 2024-11-17 09:18:20 +08:00
5 changed files with 133 additions and 65 deletions

View File

@ -1,73 +1,140 @@
name: build
name: Release
on: on:
push: push:
branches: tags:
- main - 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-2019 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@v2
- 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
target: ${{ matrix.target }} if [[ "$ver" =~ [0-9]+.[0-9]+.[0-9]+$ ]]; then
echo "rc=false" >> $GITHUB_OUTPUT
else
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: Build archive - name: Show Version Information (Rust, cargo, GCC)
shell: bash shell: bash
run: | run: |
mkdir archive gcc --version || true
# cp LICENSE README.md archive/ rustup -V
cp README.md archive/ rustup toolchain list
cd archive rustup default
if [ "${{ matrix.build }}" = "windows" ]; then cargo -V
cp "../target/${{ matrix.target }}/release/ncmmiao.exe" ./ rustc -V
# 7z a "${{ matrix.archive-name }}" LICENSE README.md ncmmiao.exe
7z a "${{ matrix.archive-name }}" README.md ncmmiao.exe - name: Build
else shell: bash
cp "../target/${{ matrix.target }}/release/ncmmiao" ./ run: $BUILD_CMD build --locked --release --target=${{ matrix.target }} ${{ matrix.cargo-flags }}
# tar -czf "${{ matrix.archive-name }}" LICENSE README.md ncmmiao
tar -czf "${{ matrix.archive-name }}" README.md ncmmiao - name: Build Archive
fi shell: bash
- name: Upload archive id: package
uses: actions/upload-artifact@v1 env:
with: target: ${{ matrix.target }}
name: ${{ matrix.archive-name }} version: ${{ steps.check-tag.outputs.version }}
path: archive/${{ matrix.archive-name }} run: |
set -euxo pipefail
bin=${GITHUB_REPOSITORY##*/}
dist_dir=`pwd`/dist
name=$bin-$version-$target
executable=target/$target/release/$bin
if [[ "$RUNNER_OS" == "Windows" ]]; then
executable=$executable.exe
fi
mkdir $dist_dir
cp $executable $dist_dir
cd $dist_dir
if [[ "$RUNNER_OS" == "Windows" ]]; then
archive=$dist_dir/$name.zip
7z a $archive *
echo "archive=dist/$name.zip" >> $GITHUB_OUTPUT
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
View File

@ -799,7 +799,7 @@ checksum = "07dcca13d1740c0a665f77104803360da0bdb3323ecce2e93fa2c959a6d52806"
[[package]] [[package]]
name = "ncmmiao" name = "ncmmiao"
version = "2.2.4" version = "2.2.6"
dependencies = [ dependencies = [
"aes", "aes",
"audiotags", "audiotags",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "ncmmiao" name = "ncmmiao"
version = "2.2.4" 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

View File

@ -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>,
/// 需要解密的文件夹或文件 /// 需要解密的文件夹或文件

View File

@ -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();