From 01898a3a8e094dfbbf981ab6f1cf38d52f60ef5d Mon Sep 17 00:00:00 2001 From: "Max P." Date: Thu, 22 May 2025 10:19:02 +0200 Subject: [PATCH 1/4] feat(tasks): add build tasks for amd64 and arm64 targets - Introduces separate build tasks for amd64 and arm64 architectures - Enables cross-compilation for better platform support --- deno.jsonc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deno.jsonc b/deno.jsonc index 2bbb2d3..1cc217b 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -2,7 +2,8 @@ "tasks": { "start": "deno run -A src/mod.ts", "test": "deno test -A --coverage **/__tests__/*.test.ts", - "build": "deno compile --include=VERSION --allow-env --allow-write --output dist/systemd-timer src/mod.ts" + "build:amd64": "deno compile --target x86_64-unknown-linux-gnu --include=VERSION --allow-env --allow-write --output dist/systemd-timer-linux-amd64 src/mod.ts", + "build:arm64": "deno compile --target aarch64-unknown-linux-gnu --include=VERSION --allow-env --allow-write --output dist/systemd-timer-linux-arm64 src/mod.ts" }, "compilerOptions": {}, "fmt": { -- 2.49.1 From 118e4e5a867a42c0d79efcc3b2a4db188affedec Mon Sep 17 00:00:00 2001 From: "Max P." Date: Thu, 22 May 2025 10:20:07 +0200 Subject: [PATCH 2/4] feat(workflows): add matrix build and SHA256 generation for releases - Introduce matrix strategy for building and uploading binaries for multiple architectures (amd64, arm64). - Generate SHA256 checksum files for release binaries. - Upload both binaries and their corresponding SHA256 files as release assets for better integrity verification. --- .gitea/workflows/upload-assets.yml | 49 ++++++++++++++---------------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/.gitea/workflows/upload-assets.yml b/.gitea/workflows/upload-assets.yml index b887b97..456a424 100644 --- a/.gitea/workflows/upload-assets.yml +++ b/.gitea/workflows/upload-assets.yml @@ -1,38 +1,27 @@ -# ======================== -# 📦 Upload Assets Template -# ======================== -# Dieser Workflow wird automatisch ausgelöst, wenn ein Release -# in Gitea veröffentlicht wurde (event: release.published). -# -# Er dient dem Zweck, Release-Artefakte (wie z. B. Binary-Dateien, -# Changelogs oder Build-Zips) nachträglich mit dem Release zu verknüpfen. -# -# Voraussetzung: Zwei Shell-Skripte liegen im Projekt: -# - .gitea/scripts/get-release-id.sh → ermittelt Release-ID per Tag -# - .gitea/scripts/upload-asset.sh → lädt Datei als Release-Asset hoch -# -# -------------------------------------- - name: Upload Assets on: release: - types: [published] # Nur bei Veröffentlichung eines Releases (nicht bei Entwürfen) + types: [published] jobs: upload-assets: runs-on: ubuntu-latest + strategy: + matrix: + include: + - target: linux + arch: amd64 + - target: linux + arch: arm64 + steps: - # 📥 Checke den Stand des Repos aus, exakt auf dem veröffentlichten Tag - # So ist garantiert, dass die Artefakte dem Zustand des Releases entsprechen. - uses: actions/checkout@v4 with: - ref: ${{ github.event.release.tag_name }} # z. B. "v1.2.3" - fetch-depth: 0 # vollständige Git-Historie (für z. B. git-cliff, logs etc.) + ref: ${{ github.event.release.tag_name }} + fetch-depth: 0 - # 🆔 Hole die Release-ID basierend auf dem Tag - # Die ID wird als Umgebungsvariable RELEASE_ID über $GITHUB_ENV verfügbar gemacht. - name: Get Release ID from tag run: .gitea/scripts/get-release-id.sh "${{ github.event.release.tag_name }}" @@ -40,8 +29,16 @@ jobs: with: deno-version: v2.x - - name: Build application - run: deno task build + - name: Build ${{ matrix.target }}-${{ matrix.arch }} + run: deno task build:${{ matrix.arch }} - - name: Upload CHANGELOG.md as RELEASE-NOTES.md - run: .gitea/scripts/upload-asset.sh ./dist/systemd-timer systemd-timer + - name: Generate SHA256 for ${{ matrix.target }}-${{ matrix.arch }} + run: | + FILE="./dist/systemd-timer-${{ matrix.target }}-${{ matrix.arch }}" + sha256sum "$FILE" > "$FILE.sha256" + + - name: Upload binary for ${{ matrix.target }}-${{ matrix.arch }} + run: .gitea/scripts/upload-asset.sh ./dist/systemd-timer-${{ matrix.target }}-${{ matrix.arch }} systemd-timer-${{ matrix.target }}-${{ matrix.arch }} + + - name: Upload SHA256 for ${{ matrix.target }}-${{ matrix.arch }} + run: .gitea/scripts/upload-asset.sh ./dist/systemd-timer-${{ matrix.target }}-${{ matrix.arch }}.sha256 systemd-timer-${{ matrix.target }}-${{ matrix.arch }}.sha256 -- 2.49.1 From 264b43c9a667d344e27cca4ac2f17d7a4a25bffc Mon Sep 17 00:00:00 2001 From: "Max P." Date: Thu, 22 May 2025 10:21:24 +0200 Subject: [PATCH 3/4] feat(scripts): add installation script for systemd-timer binary - Introduces a Bash script to install the systemd-timer binary - Detects OS and architecture to download the appropriate binary - Verifies the binary using SHA256 checksum for security - Supports installation with or without sudo privileges --- scripts/install.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 scripts/install.sh diff --git a/scripts/install.sh b/scripts/install.sh new file mode 100644 index 0000000..0708276 --- /dev/null +++ b/scripts/install.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +set -euo pipefail + +# === Konfiguration === +REPO_URL="https://git.0xmax42.io/maxp/systemd-timer/releases/download/latest" +BINARY_NAME="systemd-timer" +INSTALL_PATH="/usr/local/bin" + +# === Systemarchitektur erkennen === +ARCH=$(uname -m) +case "$ARCH" in + x86_64) ARCH="amd64" ;; + aarch64 | arm64) ARCH="arm64" ;; + *) echo "Unsupported architecture: $ARCH" >&2; exit 1 ;; +esac + +OS=$(uname -s) +case "$OS" in + Linux) OS="linux" ;; + *) echo "Unsupported OS: $OS" >&2; exit 1 ;; +esac + +# === Download-URL zusammensetzen === +BINARY_FILE="${BINARY_NAME}-${OS}-${ARCH}" +DOWNLOAD_URL="${REPO_URL}/${BINARY_FILE}" + +echo "📦 Installing ${BINARY_NAME} for ${OS}/${ARCH}..." +echo "🌐 Downloading from: ${DOWNLOAD_URL}" + +# === Binary herunterladen === +TMP_FILE=$(mktemp) +curl -fsSL "${DOWNLOAD_URL}" -o "${TMP_FILE}" +chmod +x "${TMP_FILE}" + +# === Optional: SHA256-Check === +curl -fsSL "${DOWNLOAD_URL}.sha256" -o "${TMP_FILE}.sha256" +echo "$(cat ${TMP_FILE}.sha256) ${TMP_FILE}" | sha256sum -c - + +# === Installation === +echo "🚀 Installing to ${INSTALL_PATH}/${BINARY_NAME}" +if [ -w "$INSTALL_PATH" ]; then + install -m 755 "${TMP_FILE}" "${INSTALL_PATH}/${BINARY_NAME}" +else + sudo install -m 755 "${TMP_FILE}" "${INSTALL_PATH}/${BINARY_NAME}" +fi + +echo "✅ Installation complete: $(command -v ${BINARY_NAME})" +"${BINARY_NAME}" --version || true -- 2.49.1 From 6fc6207da81d41964848595d62c7e920aecdb2d8 Mon Sep 17 00:00:00 2001 From: "Max P." Date: Thu, 22 May 2025 10:21:55 +0200 Subject: [PATCH 4/4] chore(version): update to 0.2.0 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 6c6aa7c..341cf11 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.0 \ No newline at end of file +0.2.0 \ No newline at end of file -- 2.49.1