Compare commits
4 Commits
8ed98cc998
...
1012ca5378
| Author | SHA1 | Date | |
|---|---|---|---|
|
1012ca5378
|
|||
|
6e00e89bb0
|
|||
|
403e047c0c
|
|||
|
56fb554f13
|
47
.gitea/workflows/upload-assets.yml
Normal file
47
.gitea/workflows/upload-assets.yml
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
# ========================
|
||||||
|
# 📦 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)
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
upload-assets:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
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.)
|
||||||
|
|
||||||
|
# 🆔 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 }}"
|
||||||
|
|
||||||
|
- uses: denoland/setup-deno@v2
|
||||||
|
with:
|
||||||
|
deno-version: v2.x
|
||||||
|
|
||||||
|
- name: Build application
|
||||||
|
run: deno task build
|
||||||
|
|
||||||
|
- name: Upload CHANGELOG.md as RELEASE-NOTES.md
|
||||||
|
run: .gitea/scripts/upload-asset.sh ./dist/systemd-timer systemd-timer
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
"tasks": {
|
"tasks": {
|
||||||
"start": "deno run -A src/mod.ts",
|
"start": "deno run -A src/mod.ts",
|
||||||
"test": "deno test -A --coverage **/__tests__/*.test.ts",
|
"test": "deno test -A --coverage **/__tests__/*.test.ts",
|
||||||
"build": "deno compile --allow-env --allow-write --output dist/systemd-timer src/mod.ts"
|
"build": "deno compile --include=VERSION --allow-env --allow-write --output dist/systemd-timer src/mod.ts"
|
||||||
},
|
},
|
||||||
"compilerOptions": {},
|
"compilerOptions": {},
|
||||||
"fmt": {
|
"fmt": {
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { Command } from '@cliffy/command';
|
import { Command } from '@cliffy/command';
|
||||||
import { createCommand } from './create.ts';
|
import { createCommand } from './create.ts';
|
||||||
|
import { getVersion } from '../utils/mod.ts';
|
||||||
|
|
||||||
await new Command()
|
await new Command()
|
||||||
.name('systemd-timer')
|
.name('systemd-timer')
|
||||||
.version('0.1.0')
|
.version(await getVersion())
|
||||||
.description('CLI Tool zum Erzeugen von systemd .timer und .service Units')
|
.description('CLI Tool zum Erzeugen von systemd .timer und .service Units')
|
||||||
.command('create', createCommand)
|
.command('create', createCommand)
|
||||||
.parse(Deno.args);
|
.parse(Deno.args);
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
export { resolveUnitTargetPath, writeUnitFiles } from './fs.ts';
|
export { resolveUnitTargetPath, writeUnitFiles } from './fs.ts';
|
||||||
export { deriveNameFromExec } from './misc.ts';
|
export { deriveNameFromExec } from './misc.ts';
|
||||||
|
export { getVersion } from './version.ts';
|
||||||
|
|||||||
12
src/utils/version.ts
Normal file
12
src/utils/version.ts
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
export async function getVersion(): Promise<string> {
|
||||||
|
try {
|
||||||
|
const versionUrl = new URL('../../VERSION', import.meta.url);
|
||||||
|
const version = await Deno.readTextFile(versionUrl);
|
||||||
|
return version.trim();
|
||||||
|
} catch (err) {
|
||||||
|
if (err instanceof Deno.errors.NotFound) {
|
||||||
|
return 'dev';
|
||||||
|
}
|
||||||
|
return 'unknown';
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user