Skip to content

Build and Upload ndpresponder #8

Build and Upload ndpresponder

Build and Upload ndpresponder #8

Workflow file for this run

name: Build and Upload ndpresponder
on:
repository_dispatch:
types:
- ndpresponder_update
schedule:
- cron: '0 12 * * *'
workflow_dispatch:
jobs:
build-and-upload:
name: Build, Upload ndpresponder, and Push Docker Image
runs-on: ubuntu-latest
strategy:
matrix:
architecture: [amd64, arm64]
steps:
- name: Checkout ndpresponder repository
uses: actions/checkout@v3
with:
repository: yoursunny/ndpresponder
- name: Set up Go 1.23
uses: actions/setup-go@v4
with:
go-version: 1.23
- name: Build ndpresponder
run: |
mkdir -p build
CGO_ENABLED=0 GOARCH=${{ matrix.architecture }} GOOS=linux go build -o build/ndpresponder .
- name: Upload to GitHub Releases
uses: softprops/action-gh-release@v1
with:
files: build/ndpresponder
tag_name: ${{ matrix.architecture == 'amd64' && 'ndpresponder_x86' || 'ndpresponder_aarch64' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker Image
run: |
arch_suffix=$([[ "${{ matrix.architecture }}" == "amd64" ]] && echo "x86" || echo "aarch64")
docker build -t spiritlhl/ndpresponder_${arch_suffix}:latest .
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push Docker Image
run: |
arch_suffix=$([[ "${{ matrix.architecture }}" == "amd64" ]] && echo "x86" || echo "aarch64")
docker push spiritlhl/ndpresponder_${arch_suffix}:latest