Skip to content

v0.15.0 - Enhanced Gaps View #10

v0.15.0 - Enhanced Gaps View

v0.15.0 - Enhanced Gaps View #10

Workflow file for this run

name: Build Packages
on:
release:
types: [created]
workflow_dispatch: # Allow manual trigger for testing
env:
GO_VERSION: '1.24'
jobs:
build-linux-binary:
name: Build Linux Binary
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Install GL/X11 dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgl1-mesa-dev xorg-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxxf86vm-dev
- name: Get version
id: version
run: |
VERSION="${GITHUB_REF_NAME:-$(git describe --tags --always)}"
VERSION="${VERSION#v}"
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Build Linux AMD64
run: |
VERSION=${{ steps.version.outputs.VERSION }}
mkdir -p release/linux
CGO_ENABLED=1 go build -ldflags="-s -w -X main.version=${VERSION}" -o release/linux/kartoza-timesheet-linux-amd64 .
cd release/linux
tar -czf kartoza-timesheet-${VERSION}-linux-amd64.tar.gz kartoza-timesheet-linux-amd64
sha256sum *.tar.gz > checksums-linux.txt
- name: Upload to release
if: github.event_name == 'release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ github.event.release.tag_name }} release/linux/*.tar.gz release/linux/checksums-linux.txt --clobber
- name: Upload artifact
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: linux-binary
path: release/linux/*
retention-days: 7
build-deb:
name: Build Debian Package
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y dpkg-dev debhelper devscripts libgl1-mesa-dev xorg-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxxf86vm-dev
- name: Get version
id: version
run: |
VERSION="${GITHUB_REF_NAME:-$(git describe --tags --always)}"
VERSION="${VERSION#v}"
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Build Debian package
run: |
VERSION=${{ steps.version.outputs.VERSION }}
# For deb, version must be numeric - fallback to 0.0.0 if not
if ! echo "$VERSION" | grep -qE '^[0-9]'; then
VERSION="0.0.0~${VERSION}"
fi
mkdir -p release/deb
CGO_ENABLED=1 go build -ldflags="-s -w -X main.version=${VERSION}" -o kartoza-timesheet .
PKG_DIR="release/deb/kartoza-timesheet-${VERSION}"
mkdir -p "${PKG_DIR}/usr/bin"
mkdir -p "${PKG_DIR}/usr/share/applications"
mkdir -p "${PKG_DIR}/DEBIAN"
cp kartoza-timesheet "${PKG_DIR}/usr/bin/"
cat > "${PKG_DIR}/usr/share/applications/kartoza-timesheet.desktop" << 'EOF'
[Desktop Entry]
Name=Kartoza Timesheet
Comment=Time tracking application for Kartoza
Exec=kartoza-timesheet
Terminal=false
Type=Application
Categories=Office;ProjectManagement;
EOF
# Control file - no leading whitespace allowed
printf 'Package: kartoza-timesheet\nVersion: %s\nSection: utils\nPriority: optional\nArchitecture: amd64\nDepends: libgl1, libx11-6, libxcursor1, libxrandr2, libxinerama1, libxi6\nMaintainer: Tim Sutton <tim@kartoza.com>\nDescription: Kartoza Timesheet Application\n A time tracking application with both TUI and GUI modes.\n Features include project/task tracking, favourites, POW mode,\n and integration with ERPNext timesheets.\n' "$VERSION" > "${PKG_DIR}/DEBIAN/control"
dpkg-deb --build "${PKG_DIR}"
mv "${PKG_DIR}.deb" "release/deb/kartoza-timesheet_${VERSION}_amd64.deb"
- name: Upload to release
if: github.event_name == 'release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ github.event.release.tag_name }} release/deb/*.deb --clobber
- name: Upload artifact
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: debian-package
path: release/deb/*.deb
retention-days: 7
build-rpm:
name: Build RPM Package
runs-on: ubuntu-latest
container: fedora:latest
permissions:
contents: write
steps:
- name: Install build dependencies
run: |
dnf install -y golang rpm-build git mesa-libGL-devel libX11-devel libXcursor-devel libXrandr-devel libXinerama-devel libXi-devel libXxf86vm-devel gcc gh
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Get version
id: version
run: |
VERSION="${GITHUB_REF_NAME:-$(git describe --tags --always)}"
VERSION="${VERSION#v}"
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Build RPM package
run: |
VERSION=${{ steps.version.outputs.VERSION }}
# RPM version must be numeric
RPM_VERSION="$VERSION"
if ! echo "$RPM_VERSION" | grep -qE '^[0-9]'; then
RPM_VERSION="0.0.0"
fi
# Build binary (disable VCS stamping - not available in container)
CGO_ENABLED=1 GOFLAGS=-buildvcs=false go build -ldflags="-s -w -X main.version=${VERSION}" -o kartoza-timesheet .
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
cp kartoza-timesheet ~/rpmbuild/SOURCES/
# Create spec file with no leading whitespace
cat > ~/rpmbuild/SPECS/kartoza-timesheet.spec << SPEC
Name: kartoza-timesheet
Version: ${RPM_VERSION}
Release: 1%{?dist}
Summary: Kartoza Timesheet Application
License: MIT
URL: https://github.com/kartoza/go-timesheets-go
BuildArch: x86_64
Requires: mesa-libGL, libX11, libXcursor, libXrandr, libXinerama, libXi
%description
A time tracking application with both TUI and GUI modes.
%install
mkdir -p %{buildroot}/usr/bin
mkdir -p %{buildroot}/usr/share/applications
cp %{_sourcedir}/kartoza-timesheet %{buildroot}/usr/bin/
cat > %{buildroot}/usr/share/applications/kartoza-timesheet.desktop << 'DESKTOP'
[Desktop Entry]
Name=Kartoza Timesheet
Comment=Time tracking application for Kartoza
Exec=kartoza-timesheet
Terminal=false
Type=Application
Categories=Office;ProjectManagement;
DESKTOP
%files
/usr/bin/kartoza-timesheet
/usr/share/applications/kartoza-timesheet.desktop
SPEC
rpmbuild -bb ~/rpmbuild/SPECS/kartoza-timesheet.spec
mkdir -p release/rpm
cp ~/rpmbuild/RPMS/x86_64/*.rpm release/rpm/
- name: Upload to release
if: github.event_name == 'release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ github.event.release.tag_name }} release/rpm/*.rpm --clobber
- name: Upload artifact
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: rpm-package
path: release/rpm/*.rpm
retention-days: 7
build-flatpak:
name: Build Flatpak Package
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Install GL/X11 dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgl1-mesa-dev xorg-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxxf86vm-dev
- name: Install Flatpak dependencies
run: |
sudo apt-get install -y flatpak flatpak-builder
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install --user -y flathub org.freedesktop.Platform//23.08 org.freedesktop.Sdk//23.08
- name: Get version
id: version
run: |
VERSION="${GITHUB_REF_NAME:-$(git describe --tags --always)}"
VERSION="${VERSION#v}"
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Build Flatpak
run: |
VERSION=${{ steps.version.outputs.VERSION }}
# Build the binary first (outside flatpak, with CGO)
CGO_ENABLED=1 go build -ldflags="-s -w -X main.version=${VERSION}" -o kartoza-timesheet .
mkdir -p release/flatpak
# Create a simple flatpak manifest that bundles the pre-built binary
cat > /tmp/com.kartoza.Timesheet.yml << 'MANIFEST'
app-id: com.kartoza.Timesheet
runtime: org.freedesktop.Platform
runtime-version: '23.08'
sdk: org.freedesktop.Sdk
command: kartoza-timesheet
finish-args:
- --share=network
- --filesystem=home
- --socket=x11
- --socket=wayland
- --device=dri
modules:
- name: kartoza-timesheet
buildsystem: simple
build-commands:
- install -D -m 0755 kartoza-timesheet ${FLATPAK_DEST}/bin/kartoza-timesheet
- install -D -m 0644 com.kartoza.Timesheet.desktop ${FLATPAK_DEST}/share/applications/com.kartoza.Timesheet.desktop
sources:
- type: file
path: kartoza-timesheet
- type: file
path: com.kartoza.Timesheet.desktop
MANIFEST
# Create desktop file
cat > /tmp/com.kartoza.Timesheet.desktop << 'DESKTOP'
[Desktop Entry]
Name=Kartoza Timesheet
Comment=Time tracking application for Kartoza
Exec=kartoza-timesheet
Terminal=false
Type=Application
Categories=Office;ProjectManagement;
DESKTOP
# Copy binary to build dir (desktop file already in /tmp)
cp kartoza-timesheet /tmp/
cd /tmp
flatpak-builder --user --force-clean --repo=repo build com.kartoza.Timesheet.yml
flatpak build-bundle repo "${GITHUB_WORKSPACE}/release/flatpak/kartoza-timesheet-${VERSION}.flatpak" com.kartoza.Timesheet
- name: Upload to release
if: github.event_name == 'release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ github.event.release.tag_name }} release/flatpak/*.flatpak --clobber
- name: Upload artifact
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: flatpak-package
path: release/flatpak/*.flatpak
retention-days: 7
build-macos:
name: Build macOS Package
runs-on: macos-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Get version
id: version
run: |
VERSION="${GITHUB_REF_NAME:-$(git describe --tags --always)}"
VERSION="${VERSION#v}"
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Build macOS binaries
run: |
VERSION=${{ steps.version.outputs.VERSION }}
mkdir -p release/macos
# Build for Apple Silicon (arm64) - native on macos-latest
CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w -X main.version=${VERSION}" -o release/macos/kartoza-timesheet-arm64 .
# Build for Intel (amd64)
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w -X main.version=${VERSION}" -o release/macos/kartoza-timesheet-amd64 .
# Create universal binary
lipo -create -output release/macos/kartoza-timesheet release/macos/kartoza-timesheet-amd64 release/macos/kartoza-timesheet-arm64
# Create .app bundle
APP_DIR="release/macos/Kartoza Timesheet.app/Contents"
mkdir -p "${APP_DIR}/MacOS"
mkdir -p "${APP_DIR}/Resources"
cp release/macos/kartoza-timesheet "${APP_DIR}/MacOS/"
cat > "${APP_DIR}/Info.plist" << PLIST
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>kartoza-timesheet</string>
<key>CFBundleIdentifier</key>
<string>com.kartoza.timesheet</string>
<key>CFBundleName</key>
<string>Kartoza Timesheet</string>
<key>CFBundleDisplayName</key>
<string>Kartoza Timesheet</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleVersion</key>
<string>${VERSION}</string>
<key>CFBundleShortVersionString</key>
<string>${VERSION}</string>
<key>LSMinimumSystemVersion</key>
<string>11.0</string>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>
PLIST
# Create DMG
hdiutil create -volname "Kartoza Timesheet" \
-srcfolder "release/macos/Kartoza Timesheet.app" \
-ov -format UDZO \
"release/macos/kartoza-timesheet-${VERSION}-macos-universal.dmg"
# Also create tarballs
cd release/macos
tar -czf kartoza-timesheet-${VERSION}-macos-arm64.tar.gz kartoza-timesheet-arm64
tar -czf kartoza-timesheet-${VERSION}-macos-amd64.tar.gz kartoza-timesheet-amd64
- name: Upload to release
if: github.event_name == 'release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ github.event.release.tag_name }} release/macos/*.dmg release/macos/*.tar.gz --clobber
- name: Upload artifact
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: macos-package
path: |
release/macos/*.dmg
release/macos/*.tar.gz
retention-days: 7
build-windows:
name: Build Windows Package
runs-on: windows-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Get version
id: version
shell: bash
run: |
VERSION="${GITHUB_REF_NAME:-$(git describe --tags --always)}"
VERSION="${VERSION#v}"
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Build Windows executable
shell: bash
run: |
VERSION=${{ steps.version.outputs.VERSION }}
mkdir -p release/windows
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -ldflags="-s -w -H windowsgui -X main.version=${VERSION}" -o release/windows/kartoza-timesheet.exe .
cd release/windows
7z a kartoza-timesheet-${VERSION}-windows-amd64.zip kartoza-timesheet.exe
- name: Upload to release
if: github.event_name == 'release'
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ github.event.release.tag_name }} release/windows/*.zip --clobber
- name: Upload artifact
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: windows-package
path: release/windows/*.zip
retention-days: 7