This repository was archived by the owner on Oct 31, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
147 lines (128 loc) · 4.69 KB
/
release.yml
File metadata and controls
147 lines (128 loc) · 4.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
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 }}