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/brandmeister-automation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: BrandMeister Automation

on:
# Trigger when filter-brandmeister.csv changes on main branch
push:
branches: [ main, master ]
paths:
- 'filters/filter-brandmeister.csv'

# Manual trigger
workflow_dispatch:

permissions:
contents: write

jobs:
generate-and-release:
name: Generate BrandMeister Contacts and Create Release
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.26.1'

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Generate BrandMeister contacts
id: generate
run: |
# Run the clean task which forces re-download and generates all formats
task generate-brandmeister-clean

# Capture the generated filenames
echo "files<<EOF" >> $GITHUB_OUTPUT
ls -1 outputs/brandmeister-*.csv >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

# Get timestamp from first file
first_file=$(ls -1 outputs/brandmeister-*.csv | head -1)
timestamp=$(echo "$first_file" | grep -oE '[0-9]{8}_[0-9]{6}')
echo "timestamp=$timestamp" >> $GITHUB_OUTPUT
echo "Generated files with timestamp: $timestamp"

- name: Commit generated contacts
id: commit
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"

git add outputs/

if git diff --cached --quiet; then
echo "No changes to commit"
echo "committed=false" >> $GITHUB_OUTPUT
else
timestamp="${{ steps.generate.outputs.timestamp }}"
git commit -m "Update BrandMeister contacts - $timestamp [skip ci]"
git push
echo "committed=true" >> $GITHUB_OUTPUT
echo "timestamp=$timestamp" >> $GITHUB_OUTPUT
fi

- name: Create BrandMeister Release
if: steps.commit.outputs.committed == 'true'
uses: softprops/action-gh-release@v1
with:
name: "BrandMeister Contacts ${{ steps.generate.outputs.timestamp }}"
tag_name: "bm-${{ steps.generate.outputs.timestamp }}"
files: outputs/brandmeister-*.csv
generate_release_notes: false
body: |
## BrandMeister Filtered Contacts

Generated from `filters/filter-brandmeister.csv` with timestamp `${{ steps.generate.outputs.timestamp }}`.

### Files
- **brandmeister-radioid-*.csv** - Standard RadioID.net format
- **brandmeister-dm32uv-*.csv** - Baofeng DM32UV format
- **brandmeister-at890-*.csv** - AnyTone 890 format

### Stats
Filter contains $(wc -l < filters/filter-brandmeister.csv | xargs) entries.

Auto-generated by GitHub Actions.
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83 changes: 83 additions & 0 deletions .github/workflows/generate-contacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Generate Filtered Contacts

on:
# Manual trigger
workflow_dispatch:

# Trigger when filter files change on main branch
push:
branches: [ main, master ]
paths:
- 'filters/**'

jobs:
generate:
name: Generate Filtered Contact Lists
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.26.1'

- name: Cache RadioID.net contacts
uses: actions/cache@v4
id: cache-radioid
with:
path: user.csv
key: radioid-contacts-${{ github.run_id }}
restore-keys: |
radioid-contacts-

- name: Download RadioID.net contacts
if: steps.cache-radioid.outputs.cache-hit != 'true'
run: |
echo "Downloading RadioID.net contacts..."
curl -L -o user.csv "https://radioid.net/static/user.csv"
echo "Downloaded $(wc -l < user.csv) lines"

- name: Build codeplugs binary
run: go build -o codeplugs main.go

- name: Create generated directory
run: mkdir -p generated

- name: Generate filtered contacts
run: |
# Process each filter file in filters/ directory
for filter_file in filters/*.csv; do
if [ -f "$filter_file" ]; then
filename=$(basename "$filter_file" .csv)
echo "Processing filter: $filter_file -> generated/${filename}.csv"
./codeplugs --generate-contacts \
--filter-file "$filter_file" \
--source-file user.csv \
--output-file "generated/${filename}.csv"
fi
done

- name: Check for changes
id: check-changes
run: |
git add generated/
if git diff --cached --quiet; then
echo "No changes to commit"
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "Changes detected"
echo "changed=true" >> $GITHUB_OUTPUT
fi

- name: Commit and push generated contacts
if: steps.check-changes.outputs.changed == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "Update filtered contact lists [skip ci]"
git push
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release

on:
push:
tags:
- 'v*'

permissions:
contents: write

jobs:
release:
name: Build and Release with GoReleaser
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.26.1'

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: '~> v2'
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100 changes: 100 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Test

on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]

jobs:
test-go:
name: Test Go (${{ matrix.go-version }})
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.26.1']
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Build frontend
run: task frontend-build

- name: Run tests
run: task test

- name: Run vet
run: task vet

- name: Check formatting
run: task fmt-check

test-frontend:
name: Test Frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install frontend dependencies
run: task frontend-install

- name: Build frontend
run: task frontend-build

build:
name: Build Binary
runs-on: ubuntu-latest
needs: [test-go, test-frontend]
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.26.1'

- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Build
run: task build

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: codeplugs-binary
path: codeplugs
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,11 @@ frontend/dist/

# Logs
*.log

# Generated outputs
outputs/
generated/

# Cached downloads
user.csv
radioid-net-user.csv
Loading