Enhance README with additional features and details #6
Workflow file for this run
This file contains hidden or 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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-musl | |
| os: ubuntu-latest | |
| artifact: fintool-linux-x86_64 | |
| - target: aarch64-unknown-linux-musl | |
| os: ubuntu-latest | |
| artifact: fintool-linux-aarch64 | |
| - target: aarch64-apple-darwin | |
| os: macos-latest | |
| artifact: fintool-macos-aarch64 | |
| - target: x86_64-pc-windows-gnu | |
| os: ubuntu-latest | |
| artifact: fintool-windows-x86_64.exe | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install musl tools (Linux x86_64) | |
| if: matrix.target == 'x86_64-unknown-linux-musl' | |
| run: sudo apt-get update && sudo apt-get install -y musl-tools perl make | |
| - name: Install cross-compilation tools (Linux aarch64) | |
| if: matrix.target == 'aarch64-unknown-linux-musl' | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y musl-tools perl make | |
| cargo install cross --git https://github.com/cross-rs/cross | |
| - name: Install MinGW (Windows cross-compile) | |
| if: matrix.target == 'x86_64-pc-windows-gnu' | |
| run: sudo apt-get update && sudo apt-get install -y mingw-w64 perl make | |
| - name: Cache cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.toml') }} | |
| - name: Build (cross - Linux aarch64) | |
| if: matrix.target == 'aarch64-unknown-linux-musl' | |
| run: cross build --release --target ${{ matrix.target }} | |
| env: | |
| CROSS_CONTAINER_OPTS: "--platform linux/amd64" | |
| - name: Build (native) | |
| if: matrix.target != 'aarch64-unknown-linux-musl' | |
| run: cargo build --release --target ${{ matrix.target }} | |
| env: | |
| # Static linking for musl targets is automatic | |
| # For Windows GNU, link statically | |
| RUSTFLAGS: ${{ matrix.target == 'x86_64-pc-windows-gnu' && '-C target-feature=+crt-static' || '' }} | |
| - name: Verify static linking | |
| run: | | |
| bin="target/${{ matrix.target }}/release/fintool" | |
| if [[ "${{ matrix.target }}" == *"windows"* ]]; then | |
| bin="${bin}.exe" | |
| fi | |
| echo "=== Binary info ===" | |
| file "$bin" | |
| if [[ "${{ matrix.target }}" == *"linux-musl"* ]]; then | |
| # musl binaries should be statically linked | |
| if ldd "$bin" 2>&1 | grep -q "not a dynamic executable\|statically linked"; then | |
| echo "✅ Static binary confirmed" | |
| else | |
| echo "❌ Binary is dynamically linked!" | |
| ldd "$bin" | |
| exit 1 | |
| fi | |
| elif [[ "${{ matrix.target }}" == *"apple-darwin"* ]]; then | |
| # macOS: check no non-system dylibs | |
| echo "Dynamic libraries:" | |
| otool -L "$bin" || true | |
| elif [[ "${{ matrix.target }}" == *"windows"* ]]; then | |
| echo "Windows binary — static check via file output above" | |
| fi | |
| - name: Package zip | |
| run: | | |
| dir="${{ matrix.artifact }}" | |
| mkdir -p "$dir" | |
| src="target/${{ matrix.target }}/release/fintool" | |
| if [[ "${{ matrix.target }}" == *"windows"* ]]; then | |
| cp "${src}.exe" "$dir/fintool.exe" | |
| else | |
| cp "$src" "$dir/fintool" | |
| chmod +x "$dir/fintool" | |
| fi | |
| cp config.toml.default "$dir/" | |
| zip -r "${{ matrix.artifact }}.zip" "$dir" | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact }} | |
| path: ${{ matrix.artifact }}.zip | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Create checksums | |
| run: | | |
| cd artifacts | |
| for dir in */; do | |
| for file in "$dir"*.zip; do | |
| sha256sum "$file" >> ../checksums.txt | |
| done | |
| done | |
| cat ../checksums.txt | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true | |
| files: | | |
| artifacts/fintool-linux-x86_64/fintool-linux-x86_64.zip | |
| artifacts/fintool-linux-aarch64/fintool-linux-aarch64.zip | |
| artifacts/fintool-macos-aarch64/fintool-macos-aarch64.zip | |
| artifacts/fintool-windows-x86_64.exe/fintool-windows-x86_64.exe.zip | |
| checksums.txt |