Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Release

on:
push:
tags: ["v*"]

permissions:
contents: write

jobs:
release:
name: release-${{ matrix.platform.asset_name }}
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
platform:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
asset_name: linux
arch: x86_64

- os: macos-latest
target: x86_64-apple-darwin
asset_name: darwin
arch: x86_64

- os: macos-latest
target: aarch64-apple-darwin
asset_name: darwin
arch: aarch64

- os: windows-latest
target: x86_64-pc-windows-msvc
asset_name: windows
arch: x86_64
env:
BINARY_NAME: zparse-${{ matrix.platform.asset_name }}-${{ matrix.platform.arch }}${{ matrix.platform.os == 'windows-latest' && '.exe' || '' }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Extract Release Notes
id: release-notes
if: matrix.platform.os == 'ubuntu-latest'
run: |
VERSION=${GITHUB_REF#refs/tags/}
NOTES=$(awk -v ver="$VERSION" '
/^## \[/ { if (p) { exit }; if ($2 == "['ver']") { p=1; next } }
p { print }
' CHANGELOG.md)
echo "NOTES<<EOF" >> $GITHUB_OUTPUT
echo "$NOTES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform.target }}

# Add cross-compilation support
- name: Install cross-compilation tools
if: matrix.platform.target == 'aarch64-apple-darwin'
run: |
brew install FiloSottile/musl-cross/musl-cross
rustup target add aarch64-apple-darwin

# Build the specific package
- name: Build Binary
run: |
cargo build --release --target ${{ matrix.platform.target }} -p zparse
env:
CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER: aarch64-apple-darwin-gcc

- name: Prepare Asset
shell: bash
run: |
mkdir -p release
cp target/${{ matrix.platform.target }}/release/zparse${{ matrix.platform.os == 'windows-latest' && '.exe' || '' }} \
release/${{ env.BINARY_NAME }}

# Create checksum
- name: Generate SHA-256
run: |
cd release
if [ "${{ matrix.platform.os }}" = "windows-latest" ]; then
certutil -hashfile ${{ env.BINARY_NAME }} SHA256 | grep -v "hash" > ${{ env.BINARY_NAME }}.sha256
else
shasum -a 256 ${{ env.BINARY_NAME }} > ${{ env.BINARY_NAME }}.sha256
fi

# Create Release
- name: Create Release
uses: softprops/action-gh-release@v1
with:
name: "zParse ${{ github.ref_name }}"
files: |
release/${{ env.BINARY_NAME }}
release/${{ env.BINARY_NAME }}.sha256
body: ${{ steps.release-notes.outputs.NOTES }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22 changes: 22 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
repos:
- repo: local
hooks:
- id: keywatch
name: KeyWatch Secret Scanner
entry: ./hooks/keywatch.sh
language: system
files: .*\.(rs|txt|py|js)$

- id: cargo-fmt-check
name: "Check Rust formatting with cargo fmt"
entry: cargo +nightly fmt --all -- --check
language: system
types: [rust]
files: .*\.(rs)$

- id: cargo-clippy
name: "Check Rust code with clippy"
entry: cargo clippy --all-targets --all-features -- -D warnings
language: system
types: [rust]
files: .*\.(rs)$
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Unreleased]

- Initial Release
- Support reading file, directory with verbose output in console
- Output results to a file
- Support various types of keys / secrets / tokens and etc.,
Loading
Loading