mirror of
https://github.com/traccar/traccar.git
synced 2026-08-01 02:51:20 -04:00
333 lines
11 KiB
YAML
333 lines
11 KiB
YAML
name: Build Release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: Version
|
|
required: true
|
|
default: preview
|
|
|
|
jobs:
|
|
build-server:
|
|
name: Build server
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: actions/setup-java@v5
|
|
with:
|
|
distribution: temurin
|
|
java-version: 25
|
|
cache: gradle
|
|
- run: ./gradlew assemble
|
|
- name: Stage server payload
|
|
shell: bash
|
|
run: |
|
|
mkdir -p out/{conf,lib,schema,templates}
|
|
cp target/tracker-server.jar out/
|
|
cp target/lib/* out/lib/
|
|
cp schema/* out/schema/
|
|
cp -r templates/* out/templates/
|
|
cp setup/traccar.xml out/conf/
|
|
- uses: actions/upload-artifact@v7
|
|
with:
|
|
name: staged-server
|
|
path: out
|
|
retention-days: 1
|
|
|
|
build-web:
|
|
name: Build web
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
repository: traccar/traccar-web
|
|
ref: ${{ github.ref_name }}
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version: 22
|
|
cache: npm
|
|
- run: npm ci && npm run build
|
|
- name: Stage web payload
|
|
shell: bash
|
|
run: |
|
|
mkdir -p out/web out/templates/translations
|
|
cp -r build/* out/web/
|
|
cp -r src/resources/l10n/* out/templates/translations/
|
|
- uses: actions/upload-artifact@v7
|
|
with:
|
|
name: staged-web
|
|
path: out
|
|
retention-days: 1
|
|
|
|
build-linux-64:
|
|
name: Build Linux 64 installer
|
|
needs: [build-server, build-web]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: actions/setup-java@v5
|
|
with:
|
|
distribution: temurin
|
|
java-version: 25
|
|
- run: sudo apt-get install -y makeself
|
|
- uses: actions/download-artifact@v8
|
|
with:
|
|
name: staged-server
|
|
path: setup/out
|
|
- uses: actions/download-artifact@v8
|
|
with:
|
|
name: staged-web
|
|
path: setup/out
|
|
- name: Build installer
|
|
shell: bash
|
|
working-directory: setup
|
|
run: |
|
|
mkdir -p out/data out/logs
|
|
cp setup.sh traccar.service out/
|
|
jlink --add-modules java.se,jdk.charsets,jdk.crypto.ec,jdk.unsupported --output out/jre
|
|
makeself --needroot --quiet --notemp out traccar.run "traccar" ./setup.sh
|
|
zip -q -j "traccar-linux-64-${{ github.event.inputs.version }}.zip" traccar.run README.txt
|
|
- uses: actions/upload-artifact@v7
|
|
with:
|
|
name: installers-linux-64
|
|
path: setup/traccar-linux-64-*.zip
|
|
compression-level: 0
|
|
retention-days: 1
|
|
|
|
build-linux-arm:
|
|
name: Build Linux ARM installer
|
|
needs: [build-server, build-web]
|
|
runs-on: ubuntu-24.04-arm
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: actions/setup-java@v5
|
|
with:
|
|
distribution: temurin
|
|
java-version: 25
|
|
- run: sudo apt-get install -y makeself
|
|
- uses: actions/download-artifact@v8
|
|
with:
|
|
name: staged-server
|
|
path: setup/out
|
|
- uses: actions/download-artifact@v8
|
|
with:
|
|
name: staged-web
|
|
path: setup/out
|
|
- name: Build installer
|
|
shell: bash
|
|
working-directory: setup
|
|
run: |
|
|
mkdir -p out/data out/logs
|
|
cp setup.sh traccar.service out/
|
|
jlink --add-modules java.se,jdk.charsets,jdk.crypto.ec,jdk.unsupported --output out/jre
|
|
makeself --needroot --quiet --notemp out traccar.run "traccar" ./setup.sh
|
|
zip -q -j "traccar-linux-arm-${{ github.event.inputs.version }}.zip" traccar.run README.txt
|
|
- uses: actions/upload-artifact@v7
|
|
with:
|
|
name: installers-linux-arm
|
|
path: setup/traccar-linux-arm-*.zip
|
|
compression-level: 0
|
|
retention-days: 1
|
|
|
|
build-windows:
|
|
name: Build Windows installer
|
|
needs: [build-server, build-web]
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: actions/setup-java@v5
|
|
with:
|
|
distribution: temurin
|
|
java-version: 25
|
|
- uses: actions/download-artifact@v8
|
|
with:
|
|
name: staged-server
|
|
path: setup/out
|
|
- uses: actions/download-artifact@v8
|
|
with:
|
|
name: staged-web
|
|
path: setup/out
|
|
- name: jlink runtime image
|
|
shell: bash
|
|
working-directory: setup
|
|
run: jlink --add-modules java.se,jdk.charsets,jdk.crypto.ec,jdk.unsupported --output out/jre
|
|
- name: Build installer
|
|
shell: cmd
|
|
working-directory: setup
|
|
run: '"%ProgramFiles(x86)%\Inno Setup 6\ISCC.exe" traccar.iss'
|
|
- name: Zip installer
|
|
shell: pwsh
|
|
working-directory: setup
|
|
run: |
|
|
New-Item -ItemType Directory -Path stage | Out-Null
|
|
Copy-Item Output\traccar-setup.exe stage\
|
|
Copy-Item README.txt stage\
|
|
Compress-Archive -Path stage\* -DestinationPath "traccar-windows-64-${{ github.event.inputs.version }}.zip"
|
|
- uses: actions/upload-artifact@v7
|
|
with:
|
|
name: installers-windows
|
|
path: setup/traccar-windows-64-*.zip
|
|
compression-level: 0
|
|
retention-days: 1
|
|
|
|
build-other:
|
|
name: Build other zip
|
|
needs: [build-server, build-web]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: actions/download-artifact@v8
|
|
with:
|
|
name: staged-server
|
|
path: setup/out
|
|
- uses: actions/download-artifact@v8
|
|
with:
|
|
name: staged-web
|
|
path: setup/out
|
|
- name: Build zip
|
|
shell: bash
|
|
working-directory: setup
|
|
run: |
|
|
mkdir -p out/data out/logs
|
|
cp README.txt out/
|
|
(cd out && zip -q -r "../traccar-other-${{ github.event.inputs.version }}.zip" .)
|
|
- uses: actions/upload-artifact@v7
|
|
with:
|
|
name: installers-other
|
|
path: setup/traccar-other-*.zip
|
|
compression-level: 0
|
|
retention-days: 1
|
|
|
|
test:
|
|
name: Test ${{ matrix.name }}
|
|
needs: [build-linux-64, build-linux-arm, build-windows]
|
|
runs-on: ${{ matrix.runner }}
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- name: Windows
|
|
runner: windows-latest
|
|
artifact: installers-windows
|
|
file: traccar-windows-64-${{ github.event.inputs.version }}.zip
|
|
logs_dir: "/c/Program Files/Traccar/logs"
|
|
start: sc start traccar
|
|
- name: Linux 64
|
|
runner: ubuntu-latest
|
|
artifact: installers-linux-64
|
|
file: traccar-linux-64-${{ github.event.inputs.version }}.zip
|
|
logs_dir: /opt/traccar/logs
|
|
start: sudo systemctl start traccar
|
|
sudo: sudo
|
|
- name: Linux ARM
|
|
runner: ubuntu-24.04-arm
|
|
artifact: installers-linux-arm
|
|
file: traccar-linux-arm-${{ github.event.inputs.version }}.zip
|
|
logs_dir: /opt/traccar/logs
|
|
start: sudo systemctl start traccar
|
|
sudo: sudo
|
|
steps:
|
|
- uses: actions/download-artifact@v8
|
|
with:
|
|
name: ${{ matrix.artifact }}
|
|
- name: Extract installer
|
|
run: unzip -q ${{ matrix.file }}
|
|
- name: Install (Linux)
|
|
if: runner.os == 'Linux'
|
|
run: sudo bash traccar.run
|
|
- name: Install (Windows)
|
|
if: runner.os == 'Windows'
|
|
shell: cmd
|
|
run: traccar-setup.exe /VERYSILENT /SP- /SUPPRESSMSGBOXES /NORESTART
|
|
- name: Start service and probe web port
|
|
run: |
|
|
${{ matrix.start }}
|
|
${{ matrix.sudo }} timeout 120 bash -c 'until grep -q "Started oejs.Server" "${{ matrix.logs_dir }}"/*.log 2>/dev/null; do sleep 2; done' || true
|
|
${{ matrix.sudo }} cat "${{ matrix.logs_dir }}"/*.log
|
|
curl -fsS -m 5 http://localhost:8082
|
|
|
|
publish:
|
|
name: Publish installers
|
|
needs: [test, build-other]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/download-artifact@v8
|
|
with:
|
|
pattern: installers-*
|
|
merge-multiple: true
|
|
- if: ${{ github.event.inputs.version == 'preview' }}
|
|
env:
|
|
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
|
|
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }}
|
|
run: |
|
|
sudo apt-get install -y s3cmd
|
|
s3cmd --acl-public put traccar-*.zip s3://traccar/builds/ --host=nyc3.digitaloceanspaces.com --host-bucket=traccar --access_key="$S3_ACCESS_KEY" --secret_key="$S3_SECRET_KEY"
|
|
- if: ${{ github.event.inputs.version != 'preview' }}
|
|
uses: softprops/action-gh-release@v3
|
|
with:
|
|
tag_name: v${{ github.event.inputs.version }}
|
|
files: traccar-*.zip
|
|
|
|
docker:
|
|
name: Docker ${{ matrix.os }}
|
|
needs: [test, build-other]
|
|
if: ${{ github.event.inputs.version != 'preview' }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
os: [alpine, debian, ubuntu]
|
|
include:
|
|
- platforms: linux/amd64,linux/arm64
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: actions/download-artifact@v8
|
|
with:
|
|
name: installers-other
|
|
path: docker
|
|
- uses: docker/setup-qemu-action@v4
|
|
- uses: docker/setup-buildx-action@v4
|
|
- uses: docker/login-action@v4
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
- uses: docker/login-action@v4
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- id: meta
|
|
uses: docker/metadata-action@v6
|
|
with:
|
|
flavor: latest=false
|
|
images: |
|
|
traccar/traccar
|
|
ghcr.io/traccar/traccar
|
|
tags: |
|
|
type=semver,pattern={{major}}.{{minor}}.{{patch}},suffix=-${{ matrix.os }},value=v${{ github.event.inputs.version }}
|
|
type=semver,pattern={{major}}.{{minor}},suffix=-${{ matrix.os }},value=v${{ github.event.inputs.version }}
|
|
type=semver,pattern={{major}},suffix=-${{ matrix.os }},value=v${{ github.event.inputs.version }}
|
|
type=semver,pattern={{major}}.{{minor}}.{{patch}},value=v${{ github.event.inputs.version }},enable=${{ matrix.os == 'alpine' }}
|
|
type=semver,pattern={{major}}.{{minor}},value=v${{ github.event.inputs.version }},enable=${{ matrix.os == 'alpine' }}
|
|
type=semver,pattern={{major}},value=v${{ github.event.inputs.version }},enable=${{ matrix.os == 'alpine' }}
|
|
type=raw,value=latest,enable=${{ matrix.os == 'alpine' }}
|
|
type=raw,value=${{ matrix.os }}
|
|
labels: |
|
|
org.opencontainers.image.version=${{ github.event.inputs.version }}
|
|
- uses: docker/build-push-action@v7
|
|
with:
|
|
context: docker
|
|
file: docker/Dockerfile.${{ matrix.os }}
|
|
build-args: VERSION=${{ github.event.inputs.version }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
platforms: ${{ matrix.platforms }}
|
|
push: true
|