Skip to content

Commit 5747b60

Browse files
committed
feat: Add automated installer builds
- Windows installer with Inno Setup - Linux DEB and AppImage packages - Universal tarball distribution - Automated GitHub Actions workflow
1 parent d6dfd22 commit 5747b60

File tree

5 files changed

+964
-0
lines changed

5 files changed

+964
-0
lines changed
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
name: Build MarkAPI Installers
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
paths:
7+
- 'distribution/**'
8+
- '.github/workflows/build-installers.yml'
9+
pull_request:
10+
branches: [ main ]
11+
paths:
12+
- 'distribution/**'
13+
workflow_dispatch:
14+
inputs:
15+
version:
16+
description: 'Version to build'
17+
required: false
18+
default: '1.0.0'
19+
20+
env:
21+
APP_VERSION: ${{ github.event.inputs.version || '1.0.0' }}
22+
23+
jobs:
24+
build-windows:
25+
runs-on: windows-latest
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
30+
- name: Install Inno Setup
31+
run: |
32+
Invoke-WebRequest -Uri "https://files.jrsoftware.org/is/6/innosetup-6.2.2.exe" -OutFile "innosetup.exe"
33+
Start-Process -FilePath "innosetup.exe" -ArgumentList "/VERYSILENT", "/SUPPRESSMSGBOXES", "/NORESTART" -Wait
34+
35+
- name: Update version in setup script
36+
run: |
37+
$content = Get-Content "distribution/windows/setup.iss"
38+
$content = $content -replace '#define MyAppVersion ".*"', "#define MyAppVersion `"$env:APP_VERSION`""
39+
Set-Content "distribution/windows/setup.iss" $content
40+
shell: powershell
41+
42+
- name: Build Windows installer
43+
run: |
44+
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" "distribution/windows/setup.iss"
45+
shell: powershell
46+
47+
- name: Upload Windows installer
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: markapi-windows-installer
51+
path: distribution/windows/Output/MarkAPI-Setup-*.exe
52+
53+
build-linux:
54+
runs-on: ubuntu-latest
55+
steps:
56+
- name: Checkout repository
57+
uses: actions/checkout@v4
58+
59+
- name: Install dependencies
60+
run: |
61+
sudo apt-get update
62+
sudo apt-get install -y build-essential devscripts debhelper
63+
64+
- name: Build DEB package
65+
run: |
66+
cd distribution/linux
67+
chmod +x build-deb.sh
68+
./build-deb.sh ${{ env.APP_VERSION }}
69+
70+
- name: Build AppImage
71+
run: |
72+
cd distribution/linux
73+
chmod +x build-appimage.sh
74+
./build-appimage.sh ${{ env.APP_VERSION }}
75+
76+
- name: Upload Linux packages
77+
uses: actions/upload-artifact@v4
78+
with:
79+
name: markapi-linux-packages
80+
path: |
81+
distribution/linux/dist/*.deb
82+
distribution/linux/dist/*.AppImage
83+
84+
build-universal:
85+
runs-on: ubuntu-latest
86+
steps:
87+
- name: Checkout repository
88+
uses: actions/checkout@v4
89+
90+
- name: Create universal package
91+
run: |
92+
cd distribution/universal
93+
mkdir -p ../../dist
94+
tar czf "../../dist/markapi-universal-${{ env.APP_VERSION }}.tar.gz" .
95+
zip -r "../../dist/markapi-universal-${{ env.APP_VERSION }}.zip" .
96+
97+
- name: Upload universal package
98+
uses: actions/upload-artifact@v4
99+
with:
100+
name: markapi-universal-package
101+
path: dist/markapi-universal-*
102+
103+
create-release:
104+
needs: [build-windows, build-linux, build-universal]
105+
runs-on: ubuntu-latest
106+
if: github.event_name == 'workflow_dispatch'
107+
steps:
108+
- name: Download all artifacts
109+
uses: actions/download-artifact@v4
110+
111+
- name: Create Release
112+
uses: softprops/action-gh-release@v2
113+
with:
114+
tag_name: v${{ env.APP_VERSION }}
115+
name: MarkAPI v${{ env.APP_VERSION }}
116+
draft: false
117+
prerelease: false
118+
files: |
119+
markapi-windows-installer/*
120+
markapi-linux-packages/*
121+
markapi-universal-package/*
122+
body: |
123+
# MarkAPI v${{ env.APP_VERSION }}
124+
125+
## 📦 Downloads Disponíveis
126+
127+
### Windows
128+
- **MarkAPI-Setup-${{ env.APP_VERSION }}.exe**: Instalador completo para Windows 10+
129+
130+
### Linux
131+
- **markapi_${{ env.APP_VERSION }}_amd64.deb**: Pacote para Ubuntu/Debian
132+
- **MarkAPI-${{ env.APP_VERSION }}.AppImage**: Universal Linux (64-bit)
133+
134+
### Universal
135+
- **markapi-universal-${{ env.APP_VERSION }}.tar.gz**: Para qualquer sistema com Docker
136+
137+
## 🚀 Como Instalar
138+
139+
### Windows
140+
1. Baixe `MarkAPI-Setup-${{ env.APP_VERSION }}.exe`
141+
2. Execute como Administrador
142+
3. Use o atalho "MarkAPI" para iniciar
143+
144+
### Ubuntu/Debian
145+
```bash
146+
sudo dpkg -i markapi_${{ env.APP_VERSION }}_amd64.deb
147+
markapi start
148+
```
149+
150+
### Linux Universal (AppImage)
151+
```bash
152+
chmod +x MarkAPI-${{ env.APP_VERSION }}.AppImage
153+
./MarkAPI-${{ env.APP_VERSION }}.AppImage
154+
```
155+
156+
## 📋 Requisitos
157+
158+
- **Windows**: 10+ (64-bit), 8GB RAM, Docker Desktop
159+
- **Linux**: Docker, 8GB RAM, kernel 4.0+
160+
env:
161+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

distribution/linux/build-deb.sh

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
#!/bin/bash
2+
3+
# Build DEB package for MarkAPI
4+
# Usage: ./build-deb.sh [version]
5+
6+
VERSION=${1:-1.0.0}
7+
PACKAGE_NAME="markapi"
8+
ARCH="amd64"
9+
MAINTAINER="SciELO Team <dev@scielo.org>"
10+
11+
echo "Building DEB package: ${PACKAGE_NAME}_${VERSION}_${ARCH}.deb"
12+
13+
# Create package structure
14+
PKG_DIR="dist/${PACKAGE_NAME}_${VERSION}_${ARCH}"
15+
rm -rf "$PKG_DIR"
16+
mkdir -p "$PKG_DIR"/{DEBIAN,usr/bin,usr/share/markapi,etc/markapi,usr/share/applications,usr/share/pixmaps}
17+
18+
# DEBIAN control file
19+
cat > "$PKG_DIR/DEBIAN/control" << EOF
20+
Package: $PACKAGE_NAME
21+
Version: $VERSION
22+
Section: science
23+
Priority: optional
24+
Architecture: $ARCH
25+
Depends: git
26+
Recommends: docker.io (>= 20.0) | docker-ce | docker-ce-cli, docker-compose (>= 1.25)
27+
Suggests: docker-buildx-plugin
28+
Maintainer: $MAINTAINER
29+
Description: SciELO XML Processor
30+
MarkAPI é uma ferramenta para validação, processamento e conversão
31+
de documentos XML no contexto de publicações científicas SciELO.
32+
.
33+
Funcionalidades:
34+
- Validação de XML contra esquemas
35+
- Conversão para HTML, DOCX e PDF
36+
- Interface web intuitiva
37+
- API REST para integração
38+
.
39+
Requer Docker para funcionar (pode ser docker.io, docker-ce ou Docker Desktop).
40+
Homepage: https://github.com/scieloorg/markapi
41+
EOF
42+
43+
# Post-installation script
44+
cat > "$PKG_DIR/DEBIAN/postinst" << 'EOF'
45+
#!/bin/bash
46+
set -e
47+
48+
# Add user to docker group if exists
49+
if id -u markapi &>/dev/null; then
50+
usermod -aG docker markapi 2>/dev/null || true
51+
fi
52+
53+
# Add current user to docker group
54+
if [ "$SUDO_USER" ]; then
55+
usermod -aG docker "$SUDO_USER" 2>/dev/null || true
56+
fi
57+
58+
# Enable and start docker
59+
systemctl enable docker 2>/dev/null || true
60+
systemctl start docker 2>/dev/null || true
61+
62+
# Create application directories
63+
mkdir -p /var/lib/markapi/{uploads,logs,backups}
64+
chown -R root:docker /var/lib/markapi 2>/dev/null || true
65+
chmod -R 775 /var/lib/markapi 2>/dev/null || true
66+
67+
echo ""
68+
echo "MarkAPI instalado com sucesso!"
69+
echo ""
70+
echo "Para iniciar:"
71+
echo " markapi start"
72+
echo ""
73+
echo "Acesse: http://localhost:8000"
74+
echo "Documentação: https://github.com/scieloorg/markapi"
75+
echo ""
76+
77+
# Note about docker group
78+
if [ "$SUDO_USER" ]; then
79+
echo "IMPORTANTE: Faça logout e login novamente para usar o comando 'markapi'"
80+
echo "Ou execute: sudo -u $SUDO_USER markapi start"
81+
fi
82+
EOF
83+
84+
# Pre-removal script
85+
cat > "$PKG_DIR/DEBIAN/prerm" << 'EOF'
86+
#!/bin/bash
87+
set -e
88+
89+
# Stop markapi if running
90+
if command -v markapi &> /dev/null; then
91+
markapi stop 2>/dev/null || true
92+
fi
93+
EOF
94+
95+
# Post-removal script
96+
cat > "$PKG_DIR/DEBIAN/postrm" << 'EOF'
97+
#!/bin/bash
98+
set -e
99+
100+
case "$1" in
101+
purge)
102+
# Remove application data
103+
rm -rf /var/lib/markapi 2>/dev/null || true
104+
105+
# Remove docker volumes (optional)
106+
docker volume prune -f 2>/dev/null || true
107+
;;
108+
esac
109+
EOF
110+
111+
# Make scripts executable
112+
chmod 755 "$PKG_DIR/DEBIAN/postinst"
113+
chmod 755 "$PKG_DIR/DEBIAN/prerm"
114+
chmod 755 "$PKG_DIR/DEBIAN/postrm"
115+
116+
# Copy application files
117+
cp ../universal/markapi "$PKG_DIR/usr/bin/"
118+
chmod 755 "$PKG_DIR/usr/bin/markapi"
119+
120+
# Copy application data
121+
cp -r ../universal/* "$PKG_DIR/usr/share/markapi/"
122+
chmod 755 "$PKG_DIR/usr/share/markapi/markapi"
123+
124+
# Create configuration
125+
cp ../universal/.env.example "$PKG_DIR/etc/markapi/markapi.conf"
126+
127+
# Create desktop file
128+
cat > "$PKG_DIR/usr/share/applications/markapi.desktop" << EOF
129+
[Desktop Entry]
130+
Name=MarkAPI
131+
Comment=SciELO XML Processor
132+
Exec=markapi start
133+
Icon=markapi
134+
Terminal=false
135+
Type=Application
136+
Categories=Office;Science;Development;
137+
Keywords=xml;scielo;publishing;
138+
EOF
139+
140+
# Create icon (placeholder)
141+
cat > "$PKG_DIR/usr/share/pixmaps/markapi.xpm" << 'EOF'
142+
/* XPM */
143+
static char * markapi_xpm[] = {
144+
"32 32 3 1",
145+
" c None",
146+
". c #0066CC",
147+
"+ c #FFFFFF",
148+
" ",
149+
" ........................ ",
150+
" .......................... ",
151+
" ............................ ",
152+
" ..+++++++++++++++++++++++++++.. ",
153+
" .+ +. ",
154+
" .+ MarkAPI +. ",
155+
" .+ +. ",
156+
" .+ SciELO XML +. ",
157+
" .+ Processor +. ",
158+
" .+ +. ",
159+
" .+ +. ",
160+
" .+ +. ",
161+
" .+ +. ",
162+
" .+ +. ",
163+
" .+ +. ",
164+
" .+ +. ",
165+
" .+ +. ",
166+
" .+ +. ",
167+
" .+ +. ",
168+
" .+ +. ",
169+
" .+ +. ",
170+
" .+ +. ",
171+
" .+ +. ",
172+
" .+ +. ",
173+
" .+ +. ",
174+
" .+ +. ",
175+
" .+ +. ",
176+
" .+ +. ",
177+
" ..+++++++++++++++++++++++++++.. ",
178+
" ............................ ",
179+
" .......................... ",
180+
" ........................ ",
181+
" "};
182+
EOF
183+
184+
# Build package
185+
dpkg-deb --build "$PKG_DIR"
186+
187+
echo "Package created: ${PKG_DIR}.deb"
188+
echo ""
189+
echo "To install:"
190+
echo " sudo dpkg -i ${PKG_DIR}.deb"
191+
echo " sudo apt-get install -f"
192+
echo ""
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# MarkAPI - Configuração Local
2+
USE_DOCKER=yes
3+
IPYTHONDIR=/app/.ipython
4+
POSTGRES_HOST_AUTH_METHOD=trust

0 commit comments

Comments
 (0)