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

on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
release:
types: [created]

jobs:
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
matrix:
include:
- os: ubuntu-latest
artifact_name: macf-linux-x86_64
binary_name: macf
- os: macos-13
artifact_name: macf-macos-x86_64
binary_name: macf
- os: macos-latest
artifact_name: macf-macos-arm64
binary_name: macf

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

- name: Build
run: gcc -o macf main.c

- name: Test executable
run: |
./macf 00:11:22:33:44:55 cisco
./macf 00:11:22:33:44:55 dash
./macf 00:11:22:33:44:55 colon
./macf 00:11:22:33:44:55 raw

- name: Create artifact directory
run: |
mkdir -p artifact
cp macf artifact/${{ matrix.binary_name }}
cp macf.1 artifact/
cp README.md artifact/
cp LICENSE artifact/

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: artifact/
retention-days: 90
54 changes: 54 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Release

on:
push:
tags:
- 'v*.*.*'

jobs:
build-and-release:
name: Build and Release on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
permissions:
contents: write
strategy:
matrix:
include:
- os: ubuntu-latest
artifact_name: macf-linux-x86_64
archive_name: macf-linux-x86_64.tar.gz
- os: macos-13
artifact_name: macf-macos-x86_64
archive_name: macf-macos-x86_64.tar.gz
- os: macos-latest
artifact_name: macf-macos-arm64
archive_name: macf-macos-arm64.tar.gz

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

- name: Build
run: gcc -o macf main.c

- name: Test executable
run: |
./macf 00:11:22:33:44:55 cisco
./macf 00:11:22:33:44:55 dash

- name: Create release package
run: |
mkdir -p release/${{ matrix.artifact_name }}
cp macf release/${{ matrix.artifact_name }}/
cp macf.1 release/${{ matrix.artifact_name }}/
cp README.md release/${{ matrix.artifact_name }}/
cp LICENSE release/${{ matrix.artifact_name }}/
cd release
tar -czf ${{ matrix.archive_name }} ${{ matrix.artifact_name }}

- name: Upload Release Asset
uses: softprops/action-gh-release@v1
with:
files: release/${{ matrix.archive_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Build artifacts
macf

# Editor files
*.swp
*.swo
*~
.vscode/
.idea/

# OS files
.DS_Store
Thumbs.db
46 changes: 45 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,50 @@
# macf - MAC Address Formatter

`macf` is a command-line utility for converting MAC addresses into different formats. It can process a single MAC address or multiple MAC addresses from a file.
![Build](https://github.com/hexabyte8/macf/workflows/Build/badge.svg)

`macf` is a command-line utility for converting MAC addresses into different formats. It can process a single MAC address or multiple MAC addresses from a file.

## Download

Pre-built binaries are available for Linux and macOS:

### From GitHub Actions
1. Go to the [Actions tab](https://github.com/hexabyte8/macf/actions)
2. Click on the latest successful "Build" workflow run
3. Download the artifact for your platform:
- `macf-linux-x86_64` for Linux (x86_64)
- `macf-macos-x86_64` for macOS (Intel x86_64)
- `macf-macos-arm64` for macOS (Apple Silicon ARM64)
4. Extract the archive and make the binary executable: `chmod +x macf`

### From Releases
When a release is published, download pre-built binaries from the [Releases page](https://github.com/hexabyte8/macf/releases):
- `macf-linux-x86_64.tar.gz` for Linux (x86_64)
- `macf-macos-x86_64.tar.gz` for macOS (Intel x86_64)
- `macf-macos-arm64.tar.gz` for macOS (Apple Silicon ARM64)

Extract and install:
```bash
tar -xzf macf-*.tar.gz
cd macf-*
chmod +x macf
sudo mv macf /usr/local/bin/
sudo mv macf.1 /usr/local/share/man/man1/
```

## Build from Source

To compile from source, you need GCC:

```bash
gcc -o macf main.c
```

Or use the provided installation script:

```bash
./install.sh
```

## Features

Expand Down
Loading