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
55 changes: 55 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Release Build

on:
push:
branches:
- 'release/v*.*.*'

jobs:
build-and-release:
runs-on: ubuntu-latest
name: Build and Release

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21' # Or your project's Go version

- name: Configure Git
run: |
git config --global user.email "github-actions@github.com"
git config --global user.name "github-actions"

- name: Extract release version from branch name
run: |
VERSION=${GITHUB_REF#refs/heads/release/}
echo "RELEASE_TAG=$VERSION" >> $GITHUB_ENV

- name: Create Git tag
run: |
git fetch --tags
if ! git rev-parse "$RELEASE_TAG" >/dev/null 2>&1; then
git tag "$RELEASE_TAG"
git push origin "$RELEASE_TAG"
else
echo "Tag $RELEASE_TAG already exists."
fi

- name: Build binaries
run: make build

- name: Create GitHub Release and attach binaries
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.RELEASE_TAG }}
name: ${{ env.RELEASE_TAG }}
files: |
bin/*
draft: true
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion cmd/cmd/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func DefineScanCommand() *cobra.Command {
}

cmd.Flags().StringP("dump", "d", "", "dump the found files to the specified directory")
cmd.Flags().Uint64("block-size", 0, "enforce a specific block size during scanning")
cmd.Flags().String("block-size", "0", "use the specified block size during scanning")
cmd.Flags().String("scan-buffer-size", "4MB", "the size of the scan buffer")
cmd.Flags().String("max-scan-size", "", "max number of bytes to scan")
cmd.Flags().String("max-file-size", "4GB", "maximum size of a carved file")
Expand Down
9 changes: 7 additions & 2 deletions internal/scan/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ func ScanPartition(p *disk.Partition, filePath string, opts Options) error {
}
defer outFile.Close()

blockSize := p.BlockSize
if opts.BlockSize != 0 {
blockSize = uint32(opts.BlockSize)
}

reportFileWriter := dfxml.NewDFXMLWriter(outFile)
defer reportFileWriter.Close()

Expand All @@ -115,7 +120,7 @@ func ScanPartition(p *disk.Partition, filePath string, opts Options) error {
},
Source: dfxml.Source{
ImageFilename: filePath,
SectorSize: int(p.BlockSize),
SectorSize: int(blockSize),
ImageSize: uint64(imgInfo.Size()),
},
})
Expand Down Expand Up @@ -180,7 +185,7 @@ func ScanPartition(p *disk.Partition, filePath string, opts Options) error {
logger,
registry,
int(opts.ScanBufferSize),
int(p.BlockSize),
int(blockSize),
opts.MaxFileSize,
)
for finfo := range sc.Scan(r, size) {
Expand Down
Loading