Skip to content
Open
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
128 changes: 128 additions & 0 deletions .github/workflows/build-installers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
---
name: Build MarkAPI Installers

"on":
push:
branches: [main, develop]
paths:
- 'distribution/**'
- '.github/workflows/build-installers.yml'
pull_request:
branches: [main]
paths:
- 'distribution/**'
workflow_dispatch:
inputs:
version:
description: 'Version to build'
required: false
default: '1.0.0'

env:
APP_VERSION: ${{ github.event.inputs.version || '1.0.0' }}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rossi-Luciano pesquise como usar uma versão de forma variável (consulte o repositório scms-upload (há o arquivo VERSION)


jobs:
build-windows:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Inno Setup via Chocolatey
run: |
choco install innosetup -y
shell: powershell

- name: Create missing Windows files
run: |
mkdir -p distribution/windows/scripts
mkdir -p distribution/windows/resources
echo "Placeholder" > distribution/windows/resources/license.txt
echo "Placeholder" > distribution/windows/resources/icon.ico
shell: bash

- name: Update version in setup script
run: |
if (Test-Path "distribution/windows/setup.iss") {
$content = Get-Content "distribution/windows/setup.iss"
$pattern = '#define MyAppVersion ".*"'
$replacement = "#define MyAppVersion `"$env:APP_VERSION`""
$content = $content -replace $pattern, $replacement
Set-Content "distribution/windows/setup.iss" $content
} else {
Write-Host "setup.iss not found, skipping"
}
shell: powershell

- name: Build Windows installer
run: |
if (Test-Path "distribution/windows/setup.iss") {
$inno = "C:\ProgramData\chocolatey\lib\innosetup\tools\ISCC.exe"
if (Test-Path $inno) {
& $inno "distribution/windows/setup.iss"
} else {
Write-Host "Inno Setup not found at expected location"
Get-ChildItem "C:\ProgramData\chocolatey\lib\innosetup" -Recurse -Name "ISCC.exe"
}
} else {
Write-Host "No setup.iss found, creating placeholder"
mkdir -p distribution/windows/Output
echo "Placeholder installer" > distribution/windows/Output/MarkAPI-Setup-$env:APP_VERSION.exe
}
shell: powershell

- name: Upload Windows installer
uses: actions/upload-artifact@v4
with:
name: markapi-windows-installer
path: distribution/windows/Output/MarkAPI-Setup-*.exe
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rossi-Luciano tornar "variável"


build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential devscripts debhelper

- name: Build DEB package
run: |
cd distribution/linux
chmod +x build-deb.sh
./build-deb.sh ${{ env.APP_VERSION }}

- name: Build AppImage
run: |
cd distribution/linux
chmod +x build-appimage.sh
./build-appimage.sh ${{ env.APP_VERSION }}

- name: Upload Linux packages
uses: actions/upload-artifact@v4
with:
name: markapi-linux-packages
path: |
distribution/linux/dist/*.deb
distribution/linux/dist/*.AppImage

build-universal:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Create universal package
run: |
cd distribution/universal
mkdir -p ../../dist
tar czf "../../dist/markapi-universal-${{ env.APP_VERSION }}.tar.gz" .
zip -r "../../dist/markapi-universal-${{ env.APP_VERSION }}.zip" .

- name: Upload universal package
uses: actions/upload-artifact@v4
with:
name: markapi-universal-package
path: dist/markapi-universal-*
88 changes: 88 additions & 0 deletions distribution/linux/build-appimage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#!/bin/bash

# Build AppImage for MarkAPI
# Usage: ./build-appimage.sh [version]

VERSION=${1:-1.0.0}
APP_NAME="MarkAPI"

echo "Building AppImage: ${APP_NAME}-${VERSION}.AppImage"

# Create AppDir structure
APPDIR="${APP_NAME}.AppDir"
rm -rf "$APPDIR"
mkdir -p "$APPDIR"/{usr/bin,usr/share/applications,usr/share/icons/hicolor/256x256/apps}

# Create AppRun script
cat > "$APPDIR/AppRun" << 'APPRUN_EOF'
#!/bin/bash

# MarkAPI AppImage Launcher

APPDIR="$(dirname "$(readlink -f "$0")")"
export PATH="$APPDIR/usr/bin:$PATH"

# Check if Docker is available
if ! command -v docker &> /dev/null; then
if command -v zenity &> /dev/null; then
zenity --error --title="MarkAPI" --text="Docker não está instalado!\n\nInstale Docker para usar o MarkAPI:\n\nUbuntu/Debian: sudo apt install docker.io\nFedora: sudo dnf install docker\nArch: sudo pacman -S docker"
else
echo "ERRO: Docker não está instalado!"
echo "Instale Docker para usar o MarkAPI"
fi
exit 1
fi

# Check if Docker is running
if ! docker info &> /dev/null; then
if command -v zenity &> /dev/null; then
zenity --error --title="MarkAPI" --text="Docker não está rodando!\n\nInicie Docker:\nsudo systemctl start docker\n\nOu adicione seu usuário ao grupo docker:\nsudo usermod -aG docker $USER"
else
echo "ERRO: Docker não está rodando!"
echo "Inicie: sudo systemctl start docker"
fi
exit 1
fi

# Create working directory
WORKDIR="$HOME/.markapi"
mkdir -p "$WORKDIR"

# Copy application files if not exists
if [ ! -f "$WORKDIR/markapi" ]; then
cp -r "$APPDIR/usr/share/markapi"/* "$WORKDIR/"
chmod +x "$WORKDIR/markapi"
fi

# Change to working directory
cd "$WORKDIR"

# Check arguments
case "$1" in
""|"start")
./markapi start
;;
*)
./markapi "$@"
;;
esac
APPRUN_EOF

chmod +x "$APPDIR/AppRun"

# Copy application files
cp -r ../universal/* "$APPDIR/usr/share/markapi/"
cp ../universal/markapi "$APPDIR/usr/bin/"
chmod +x "$APPDIR/usr/bin/markapi"

# Create desktop file
cat > "$APPDIR/markapi.desktop" << EOF
[Desktop Entry]
Name=MarkAPI
Comment=SciELO XML Processor
Exec=AppRun
Icon=markapi
Type=Application
Categories=Office;Science;Development;
Keywords=xml;scielo;publishing;
X-AppImage-Version=$VERSION
Loading