Skip to content

Commit bed1587

Browse files
authored
fix(workflow-plugins): ZMSA-20: Add initial worklfow and plugins files
* implement workflow to build Wildduck, Zone-MTA and Haraka * use release version as ref, rename archives to include version * allow to manually specify release version of service, fix zip and tar (don't include git folders) * .gitignore add end line
1 parent 250f810 commit bed1587

File tree

5 files changed

+177
-0
lines changed

5 files changed

+177
-0
lines changed

.github/workflows/release.yaml

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
name: Build and Release (Matrix)
2+
3+
on:
4+
push:
5+
tags:
6+
- "**"
7+
workflow_dispatch:
8+
inputs:
9+
wildduck_version:
10+
description: "Wildduck version (leave empty for latest)"
11+
required: false
12+
type: string
13+
zonemta_version:
14+
description: "Zone-MTA version (leave empty for latest)"
15+
required: false
16+
type: string
17+
haraka_version:
18+
description: "Haraka version (leave empty for latest)"
19+
required: false
20+
type: string
21+
22+
jobs:
23+
build:
24+
runs-on: ubuntu-latest
25+
strategy:
26+
matrix:
27+
project:
28+
- name: wildduck
29+
repo: zone-eu/wildduck
30+
ref: master
31+
- name: zone-mta
32+
repo: zone-eu/zone-mta
33+
ref: master
34+
- name: haraka
35+
repo: haraka/Haraka
36+
ref: master
37+
38+
steps:
39+
- name: Checkout workflow repo
40+
uses: actions/checkout@v6
41+
42+
- name: Get version for ${{ matrix.project.name }}
43+
id: get_version
44+
run: |
45+
# Check if explicit version is provided via workflow input
46+
case "${{ matrix.project.name }}" in
47+
wildduck)
48+
EXPLICIT_VERSION="${{ inputs.wildduck_version }}"
49+
;;
50+
zone-mta)
51+
EXPLICIT_VERSION="${{ inputs.zonemta_version }}"
52+
;;
53+
haraka)
54+
EXPLICIT_VERSION="${{ inputs.haraka_version }}"
55+
;;
56+
esac
57+
58+
if [ -n "$EXPLICIT_VERSION" ]; then
59+
echo "Using explicit version: $EXPLICIT_VERSION"
60+
echo "tag=$EXPLICIT_VERSION" >> $GITHUB_OUTPUT
61+
else
62+
# Fetch latest release
63+
LATEST_TAG=$(curl -s https://api.github.com/repos/${{ matrix.project.repo }}/releases/latest \
64+
| jq -r '.tag_name')
65+
66+
if [ -z "$LATEST_TAG" ] || [ "$LATEST_TAG" = "null" ]; then
67+
echo "No release tags found, falling back to master"
68+
LATEST_TAG="${{ matrix.project.ref }}"
69+
fi
70+
71+
echo "tag=$LATEST_TAG" >> $GITHUB_OUTPUT
72+
echo "Using tag/ref: $LATEST_TAG for ${{ matrix.project.name }}"
73+
fi
74+
75+
- name: Checkout ${{ matrix.project.name }}
76+
uses: actions/checkout@v6
77+
with:
78+
repository: ${{ matrix.project.repo }}
79+
ref: ${{ steps.get_version.outputs.tag }}
80+
path: ${{ matrix.project.name }}
81+
82+
- name: Setup Node.js
83+
uses: actions/setup-node@v6
84+
with:
85+
node-version: "24"
86+
87+
- name: Install dependencies
88+
run: npm i --omit=dev
89+
working-directory: ${{ matrix.project.name }}
90+
91+
- name: Install plugins for ${{ matrix.project.name }}
92+
run: |
93+
PLUGIN_FILE="${GITHUB_WORKSPACE}/plugins/${{ matrix.project.name }}.txt"
94+
95+
if [ -f "$PLUGIN_FILE" ]; then
96+
echo "📦 Installing plugins for ${{ matrix.project.name }}..."
97+
plugin_count=0
98+
99+
while IFS= read -r plugin || [ -n "$plugin" ]; do
100+
# Skip empty lines and comments
101+
if [ -z "$plugin" ] || [[ "$plugin" =~ ^#.* ]]; then
102+
continue
103+
fi
104+
105+
# Trim whitespace
106+
plugin=$(echo "$plugin" | xargs)
107+
108+
echo "Installing: $plugin"
109+
if npm install --save-exact "$plugin"; then
110+
plugin_count=$((plugin_count + 1))
111+
echo "✓ Successfully installed $plugin"
112+
else
113+
echo "✗ Failed to install $plugin"
114+
exit 1
115+
fi
116+
done < "$PLUGIN_FILE"
117+
118+
echo "✅ Installed $plugin_count plugins successfully"
119+
else
120+
echo "❌ No plugin file found, skipping plugin installation"
121+
fi
122+
working-directory: ${{ matrix.project.name }}
123+
124+
- name: Create archives
125+
run: |
126+
cd ${{ matrix.project.name }}
127+
zip -q -r ../${{ matrix.project.name }}-${{ steps.get_version.outputs.tag }}.zip . -x "*.git" "*.git/*"
128+
tar --exclude='.git' --exclude='.git/*' -czf ../${{ matrix.project.name }}-${{ steps.get_version.outputs.tag }}.tar.gz .
129+
130+
- name: Upload artifact
131+
uses: actions/upload-artifact@v5
132+
with:
133+
name: ${{ matrix.project.name }}-build
134+
path: |
135+
${{ matrix.project.name }}-${{ steps.get_version.outputs.tag }}.zip
136+
${{ matrix.project.name }}-${{ steps.get_version.outputs.tag }}.tar.gz
137+
138+
create-release:
139+
needs: build
140+
runs-on: ubuntu-latest
141+
permissions:
142+
contents: write
143+
steps:
144+
- name: Download all artifacts
145+
uses: actions/download-artifact@v6
146+
with:
147+
path: artifacts
148+
149+
- name: Create Release
150+
uses: softprops/action-gh-release@v2
151+
with:
152+
files: |
153+
artifacts/*/*.zip
154+
artifacts/*/*.tar.gz
155+
draft: false
156+
prerelease: false
157+
generate_release_notes: true
158+
body: |
159+
## Mail Server Stack Build
160+
161+
This release includes:
162+
- Wildduck
163+
- Zone-MTA
164+
- Haraka
165+
166+
All projects built with production-ready plugins added.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/tmp

plugins/haraka.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
haraka-plugin-redis
2+
haraka-plugin-rspamd
3+
haraka-plugin-wildduck
4+
haraka-plugin-headers

plugins/wildduck.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@zone-eu/wildduck-zonemta-zilter

plugins/zone-mta.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
zonemta-delivery-counters
2+
zonemta-limiter
3+
zonemta-loop-breaker
4+
@zone-eu/wildduck-zonemta-zilter
5+
@zone-eu/zonemta-wildduck

0 commit comments

Comments
 (0)