Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 88 additions & 51 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Build and Release

on:
push:
branches: [ main ]
branches: [ main, dev ]
tags: [ 'v*' ]
pull_request:
branches: [ main ]
branches: [ main, dev ]
workflow_dispatch:

env:
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
id: server-info
run: |
cd server
echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
echo "version=$(git log -1 --format=%cs | tr '-' '.')" >> $GITHUB_OUTPUT

- name: Upload server artifacts
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -135,7 +135,7 @@ jobs:
context: .
file: server/test/e2e/Dockerfile.server
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
push: ${{ github.event_name != 'pull_request' && github.ref != 'refs/heads/dev' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
Expand All @@ -145,9 +145,6 @@ jobs:
name: Build Distribution Packages
runs-on: ubuntu-latest
needs: [build-core, build-server]
strategy:
matrix:
arch: [amd64, arm64]
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -176,48 +173,33 @@ jobs:
name: server-artifacts
path: ./

- name: Update nfpm config for architecture
run: |
# Create arch-specific config
sed 's/arch: "amd64"/arch: "${{ matrix.arch }}"/' nfpm/nfpm.yaml > nfpm-${{ matrix.arch }}.yaml

# Debug: show the config
echo "Generated nfpm config for ${{ matrix.arch }}:"
cat nfpm-${{ matrix.arch }}.yaml

- name: Build deb package
- name: Build packages
env:
VERSION: ${{ needs.build-server.outputs.server-version }}
run: |
mkdir -p dist/packages
nfpm package \
--config nfpm-${{ matrix.arch }}.yaml \
--config nfpm/nfpm.yaml \
--packager deb \
--target dist/packages/ldap-gateway_${{ needs.build-server.outputs.server-version }}_${{ matrix.arch }}.deb

- name: Build rpm package
run: |
mkdir -p dist/packages
--target dist/packages/ldap-gateway_${VERSION}-1_all.deb
nfpm package \
--config nfpm-${{ matrix.arch }}.yaml \
--config nfpm/nfpm.yaml \
--packager rpm \
--target dist/packages/ldap-gateway-${{ needs.build-server.outputs.server-version }}-1.${{ matrix.arch }}.rpm
--target dist/packages/ldap-gateway-${VERSION}-1.noarch.rpm

- name: Verify packages
run: |
echo "Built packages:"
ls -lh dist/packages/

# Basic validation for amd64 (can't validate arm64 on x86_64 runner)
if [ "${{ matrix.arch }}" = "amd64" ]; then
echo "Package info for .deb:"
dpkg-deb --info dist/packages/*.deb || true
echo "Package info for .rpm:"
rpm -qip dist/packages/*.rpm || true
fi
echo "Package info for .deb:"
dpkg-deb --info dist/packages/*.deb || true
echo "Package info for .rpm:"
rpm -qip dist/packages/*.rpm || true

- name: Upload packages
uses: actions/upload-artifact@v4
with:
name: packages-${{ matrix.arch }}
name: packages
path: dist/packages/
retention-days: 30

Expand Down Expand Up @@ -247,8 +229,7 @@ jobs:
mkdir -p dist

# Copy packages
cp artifacts/packages-amd64/* dist/ 2>/dev/null || echo "No amd64 packages"
cp artifacts/packages-arm64/* dist/ 2>/dev/null || echo "No arm64 packages"
cp artifacts/packages/* dist/ 2>/dev/null || echo "No packages"

# Copy binary if needed for tarball creation
cp artifacts/server-artifacts/dist/ldap-gateway dist/ 2>/dev/null || echo "No binary"
Expand All @@ -268,9 +249,6 @@ jobs:
run: |
cd dist
sha256sum *.deb *.rpm > checksums.txt 2>/dev/null || echo "No packages to checksum"
if [ -f *.tar.gz ]; then
sha256sum *.tar.gz >> checksums.txt
fi
cat checksums.txt

- name: Extract version
Expand All @@ -285,11 +263,8 @@ jobs:
draft: false
prerelease: ${{ contains(steps.version.outputs.version, '-') }}
files: |
dist/ldap-gateway-*.tar.gz
dist/ldap-gateway_*_amd64.deb
dist/ldap-gateway_*_arm64.deb
dist/ldap-gateway-*-1.amd64.rpm
dist/ldap-gateway-*-1.arm64.rpm
dist/ldap-gateway_*.deb
dist/ldap-gateway-*.rpm
dist/checksums.txt
body: |
## LDAP Gateway ${{ steps.version.outputs.version }}
Expand All @@ -306,24 +281,86 @@ jobs:

**Ubuntu/Debian:**
```bash
curl -LO https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/ldap-gateway_${{ steps.version.outputs.version }}_amd64.deb
sudo dpkg -i ldap-gateway_${{ steps.version.outputs.version }}_amd64.deb
curl -LO https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/ldap-gateway_${{ steps.version.outputs.version }}-1_all.deb
sudo dpkg -i ldap-gateway_${{ steps.version.outputs.version }}-1_all.deb
```

**RHEL/CentOS/Fedora:**
```bash
curl -LO https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/ldap-gateway-${{ steps.version.outputs.version }}-1.amd64.rpm
sudo rpm -i ldap-gateway-${{ steps.version.outputs.version }}-1.amd64.rpm
curl -LO https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/ldap-gateway-${{ steps.version.outputs.version }}-1.noarch.rpm
sudo rpm -i ldap-gateway-${{ steps.version.outputs.version }}-1.noarch.rpm
```

**ARM64 packages are also available** - replace `amd64` with `arm64` in the URLs above.

### Changes
See [CHANGELOG.md](CHANGELOG.md) for detailed changes.

### Verification
All release assets include SHA256 checksums in `checksums.txt`.

dev-release:
name: Dev Pre-Release
runs-on: ubuntu-latest
needs: [build-core, build-server, build-packages]
if: github.ref == 'refs/heads/dev' && github.event_name == 'push'
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts

- name: Organize dev release assets
run: |
mkdir -p dist
cp artifacts/packages/*.deb dist/ 2>/dev/null || true
cp artifacts/packages/*.rpm dist/ 2>/dev/null || true

# Rename packages with dev- prefix for clarity
cd dist
for f in *.deb *.rpm; do
[ -f "$f" ] && mv "$f" "dev-${f}"
done

echo "Dev release assets:"
ls -lh

- name: Generate checksums
run: |
cd dist
sha256sum * > checksums.txt 2>/dev/null || true
cat checksums.txt

- name: Update dev-latest release
uses: softprops/action-gh-release@v1
with:
tag_name: dev-latest
name: "Dev Build (latest from dev branch)"
draft: false
prerelease: true
make_latest: false
files: |
dist/*
body: |
## Dev Build — ${{ github.sha }}

**This is an automated pre-release from the `dev` branch.**
Updated on every push to `dev`. Not for production use.

Commit: ${{ github.sha }}
Date: ${{ github.event.head_commit.timestamp }}

### Install on Proxmox (Debian/Ubuntu)
```bash
ldap-gateway-upgrade --dev
```

Or manually:
```bash
curl -LO https://github.com/${{ github.repository }}/releases/download/dev-latest/dev-ldap-gateway_${{ needs.build-server.outputs.server-version }}-1_all.deb
sudo dpkg -i dev-ldap-gateway_*_all.deb
```

publish-npm:
name: Publish to npm
runs-on: ubuntu-latest
Expand Down Expand Up @@ -385,4 +422,4 @@ jobs:
"version": "${{ steps.release-info.outputs.version }}",
"url": "https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/ldap-gateway-${{ steps.release-info.outputs.version }}.tar.gz",
"sha256": "${{ steps.release-info.outputs.sha256 }}"
}
}
9 changes: 5 additions & 4 deletions nfpm/nfpm.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: "ldap-gateway"
arch: "amd64"
arch: "all"
platform: "linux"
version: "v1.0.0"
version: "${VERSION}"
release: 1
section: "default"
priority: "extra"
maintainer: "MieWeb <support@mieweb.com>"
maintainer: "MIEWeb <support@mieweb.com>"
description: |
LDAP Gateway Server - A bridge between LDAP authentication and various backends

Expand All @@ -21,7 +22,7 @@ description: |
- Comprehensive audit logging
- POSIX account and group support
- Easy configuration via environment variables
vendor: "MieWeb"
vendor: "MIEWeb"
homepage: "https://github.com/mieweb/LDAPServer"
license: "MIT"

Expand Down
8 changes: 6 additions & 2 deletions nfpm/systemd/ldap-gateway.service
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Environment=NODE_ENV=production
EnvironmentFile=-/etc/default/ldap-gateway

# Start the server
ExecStart=/usr/bin/env node /opt/ldap-gateway/server/index.js
ExecStart=/usr/bin/env node /opt/ldap-gateway/index.js

# Security settings
NoNewPrivileges=yes
Expand All @@ -26,7 +26,11 @@ ProtectSystem=strict
ProtectHome=yes

# Allow creating self-signed certs on startup
ReadWritePaths=/opt/ldap-gateway/server/cert
ReadWritePaths=/opt/ldap-gateway/cert

# Allow reading Proxmox config files (if using proxmox backend)
# Prefixed with - so the service starts even if these paths don't exist
ReadOnlyPaths=-/mnt/pve -/mnt/priv

# Capabilities
AmbientCapabilities=CAP_NET_BIND_SERVICE
Expand Down
Loading
Loading