Skip to content

Commit c5ebbad

Browse files
committed
Added first catalog makefile
1 parent 565d7a4 commit c5ebbad

File tree

3 files changed

+86
-4
lines changed

3 files changed

+86
-4
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Publish Catalog Makefiles
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'catalog/**/*.mk'
8+
9+
permissions:
10+
packages: write
11+
contents: read
12+
13+
jobs:
14+
publish-catalog:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/[email protected]
18+
19+
- name: Install Remake CLI
20+
run: |
21+
curl -fsSL https://raw.githubusercontent.com/TrianaLab/remake/main/scripts/get-remake.sh | bash
22+
23+
- name: Login to GitHub Container Registry
24+
run: |
25+
remake login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Determine release tag
28+
id: tag
29+
run: |
30+
git fetch --tags
31+
echo "::set-output name=VERSION::$(git describe --tags --abbrev=0)"
32+
33+
- name: Publish Makefiles as OCI artifacts
34+
run: |
35+
for filepath in catalog/**/*.mk; do
36+
NAME=$(basename "$filepath" .mk)
37+
38+
# Extract version defined in the Makefile (requires each .mk to define VERSION := x.y.z)
39+
VERSION=$(grep -E '^VERSION[[:space:]]*:?=' "$filepath" | head -n1 | sed 's/.*[:=]\s*//')
40+
41+
if [ -z "$VERSION" ]; then
42+
echo "[warning] No VERSION found in $filepath, skipping"
43+
continue
44+
fi
45+
46+
echo "Publishing $filepath as tags: $VERSION, latest"
47+
remake push -f "$filepath" ghcr.io/TrianaLab/$NAME:$VERSION
48+
remake push -f "$filepath" ghcr.io/TrianaLab/$NAME:latest
49+
done

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,4 @@ go.work.sum
2626
.env
2727

2828
# VSCode
29-
.vscode/
30-
31-
# Makefiles
32-
*.mk
29+
.vscode/

catalog/runtimes/make-os.mk

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# make-os.mk — Detect host OS, distribution, version, and architecture
2+
# Supports: Linux (any distro), macOS, Windows (via PowerShell)
3+
4+
VERSION := 0.1.0
5+
6+
.PHONY: detect
7+
8+
detect:
9+
ifeq ($(OS),Windows_NT)
10+
@powershell -NoProfile -Command "\
11+
$ver = (Get-CimInstance Win32_OperatingSystem).Version; \
12+
$arch = if ($env:PROCESSOR_ARCHITECTURE -match 'ARM') { 'arm64' } else { 'amd64' }; \
13+
Write-Output \"windows windows $ver $arch\"\
14+
"
15+
else
16+
@sh -c '\
17+
UNAME_S="$$(uname -s)"; \
18+
UNAME_M="$$(uname -m)"; \
19+
if [ "$$UNAME_S" = "Darwin" ]; then \
20+
OS_NAME=macos; \
21+
DISTRO=macos; \
22+
VERSION="$$(sw_vers -productVersion)"; \
23+
else \
24+
OS_NAME=linux; \
25+
. /etc/os-release; \
26+
DISTRO="$$ID"; \
27+
VERSION="$$VERSION_ID"; \
28+
fi; \
29+
if echo $$UNAME_M | grep -qE "arm|aarch64"; then \
30+
ARCH=arm64; \
31+
else \
32+
ARCH=amd64; \
33+
fi; \
34+
echo "$$OS_NAME $$DISTRO $$VERSION $$ARCH"; \
35+
'
36+
endif

0 commit comments

Comments
 (0)