This repository was archived by the owner on Oct 31, 2025. It is now read-only.
π docs(README.md): update description for clarity
#12
Workflow file for this run
This file contains hidden or 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 and Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| build: | |
| name: Build and Release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.23' | |
| - name: Get tag version | |
| id: get_version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
| - name: Build for multiple platforms | |
| id: build_release | |
| run: | | |
| mkdir -p release | |
| platforms=( | |
| "linux,amd64," | |
| "linux,arm64," | |
| "darwin,amd64," | |
| "darwin,arm64," | |
| "windows,amd64,.exe" | |
| ) | |
| for platform in "${platforms[@]}"; do | |
| IFS=',' read -r GOOS GOARCH EXT <<< "$platform" | |
| echo "Building for $GOOS/$GOARCH..." | |
| export GOOS=$GOOS | |
| export GOARCH=$GOARCH | |
| output_name="neoprotect-notifier-$GOOS-$GOARCH$EXT" | |
| go build -v -o "release/$output_name" -ldflags="-X main.Version=${{ env.VERSION }}" | |
| pushd release | |
| sha256sum "$output_name" > "${output_name}.sha256" | |
| popd | |
| done | |
| ls -la release/ | |
| - name: Prepare config.json.example | |
| run: | | |
| cat > release/config.json.example << 'EOF' | |
| { | |
| "apiKey": "your-neoprotect-api-key", | |
| "apiEndpoint": "https://api.neoprotect.net/v2", | |
| "pollIntervalSeconds": 60, | |
| "monitorMode": "all", | |
| "specificIPs": [ | |
| "192.168.1.1" | |
| ], | |
| "blacklistedIPs": [ | |
| "192.168.1.100" | |
| ], | |
| "enabledIntegrations": [ | |
| "discord", | |
| "webhook", | |
| "console" | |
| ], | |
| "integrationConfigs": { | |
| "discord": { | |
| "webhookUrl": "https://discord.com/api/webhooks/YOUR/DISCORD/WEBHOOK", | |
| "username": "NeoProtect Monitor" | |
| }, | |
| "discord_bot": { | |
| "token": "YOUR_DISCORD_BOT_TOKEN", | |
| "clientId": "YOUR_DISCORD_CLIENT_ID", | |
| "guildId": "YOUR_DISCORD_GUILD_ID", | |
| "channelId": "YOUR_DISCORD_CHANNEL_ID", | |
| "commandsEnabled": true, | |
| "allowedRoles": ["ROLE_ID_1", "ROLE_ID_2", "ROLE_ID_3"] | |
| }, | |
| "webhook": { | |
| "url": "https://your-webhook-endpoint.com/notify", | |
| "headers": { | |
| "Authorization": "Bearer your-token-here", | |
| "Content-Type": "application/json" | |
| }, | |
| "timeout": 10 | |
| }, | |
| "console": { | |
| "logPrefix": "NEOPROTECT", | |
| "formatJson": false, | |
| "colorEnabled": true | |
| } | |
| } | |
| } | |
| EOF | |
| - name: Create archive files | |
| run: | | |
| cd release | |
| for PLATFORM in linux-amd64 linux-arm64 darwin-amd64 darwin-arm64; do | |
| if [ -f "neoprotect-notifier-$PLATFORM" ] && [ -f "neoprotect-notifier-$PLATFORM.sha256" ]; then | |
| echo "Creating archive for $PLATFORM" | |
| tar -czf "neoprotect-notifier-$PLATFORM.tar.gz" "neoprotect-notifier-$PLATFORM" "neoprotect-notifier-$PLATFORM.sha256" config.json.example | |
| else | |
| echo "Warning: Missing files for $PLATFORM" | |
| fi | |
| done | |
| if [ -f "neoprotect-notifier-windows-amd64.exe" ]; then | |
| echo "Creating archive for windows-amd64" | |
| apt-get update && apt-get install -y zip | |
| zip neoprotect-notifier-windows-amd64.zip neoprotect-notifier-windows-amd64.exe neoprotect-notifier-windows-amd64.exe.sha256 config.json.example | |
| else | |
| echo "Warning: Missing files for windows-amd64" | |
| fi | |
| echo "Created archives:" | |
| ls -la *.tar.gz *.zip 2>/dev/null || echo "No archives created" | |
| - name: Create Release | |
| id: create_release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| name: NeoProtect Notifier ${{ env.VERSION }} | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| files: | | |
| release/neoprotect-notifier-linux-amd64.tar.gz | |
| release/neoprotect-notifier-linux-arm64.tar.gz | |
| release/neoprotect-notifier-darwin-amd64.tar.gz | |
| release/neoprotect-notifier-darwin-arm64.tar.gz | |
| release/neoprotect-notifier-windows-amd64.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |