clean up in code and spelling #559
This file contains 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: Build Test | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ^1.19 | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Get dependencies | |
run: | | |
sudo apt install -y libpcap0.8-dev | |
go get -v ./cmd/dnsmonster | |
- name: Build | |
run: go build -v ./cmd/dnsmonster | |
- name: Test | |
run: go test -v ./cmd/dnsmonster | |
- name: generate sample config file | |
run: ./dnsmonster --writeConfig=config-sample.ini | |
- name: update README command line options | |
run: | | |
START="$(($(grep -n "start of command line options" README.md | cut -f1 -d:)+2))" | |
END="$(($(grep -n "end of command line options" README.md | cut -f1 -d:)-2))" | |
USAGE=$(cat <<-END | |
$(./dnsmonster --writeConfig /dev/stdout | sed -E 's/^;/#/; s/^\w/--\l&/; s/^\[/# \[/; s/ =.?/=/; s/=false|stderr//') | |
END | |
) | |
awk -v var="$USAGE" 'NR=='$START'{print var} NR<'$START' || NR>'$END README.md > README.tmp | |
mv README.tmp README.md | |
working-directory: "." | |
- name: Commit changes | |
if: ${{ github.event_name == 'push' }} # only commit changes if it's a push to branch not a PR | |
uses: EndBug/add-and-commit@v9 | |
with: | |
author_name: Ali Mosajjal | |
author_email: mosajjal@gmail.com | |
message: "auto update sample ini" | |
add: "config-sample.ini README.md" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dnsmonster-linux-amd64.bin | |
path: ./dnsmonster |