Skip to content

Commit 1e9ec32

Browse files
committed
workflow fix
1 parent f0e5533 commit 1e9ec32

2 files changed

Lines changed: 16 additions & 40 deletions

File tree

.github/workflows/docker.yaml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ on:
44
push:
55
tags:
66
- "v*"
7-
branches:
8-
- "dev"
97
workflow_dispatch:
108

119
jobs:
@@ -35,11 +33,7 @@ jobs:
3533
- name: Generate Docker tags (Bun)
3634
id: tags-bun
3735
run: |
38-
if [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then
39-
TAGS=$(bun scripts/gen-container-img-tags.ts bun --beta)
40-
else
41-
TAGS=$(bun scripts/gen-container-img-tags.ts bun)
42-
fi
36+
TAGS=$(bun scripts/gen-container-img-tags.ts bun)
4337
echo "tags=$TAGS" >> $GITHUB_OUTPUT
4438
4539
- name: Build and push Docker image (Bun)
@@ -78,11 +72,7 @@ jobs:
7872
- name: Generate Docker tags (Node)
7973
id: tags-node
8074
run: |
81-
if [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then
82-
TAGS=$(bun scripts/gen-container-img-tags.ts node --beta)
83-
else
84-
TAGS=$(bun scripts/gen-container-img-tags.ts node)
85-
fi
75+
TAGS=$(bun scripts/gen-container-img-tags.ts node)
8676
echo "tags=$TAGS" >> $GITHUB_OUTPUT
8777
8878
- name: Build and push Docker image (Node)
@@ -99,7 +89,6 @@ jobs:
9989
release:
10090
name: Create GitHub Release
10191
runs-on: ubuntu-latest
102-
if: startsWith(github.ref, 'refs/tags/')
10392
permissions:
10493
contents: write
10594
needs: [build-and-push-bun, build-and-push-node]

scripts/gen-container-img-tags.ts

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,31 @@ interface PackageJson {
55
version: string
66
}
77

8-
function generateTags(
9-
version: string,
10-
runtime: "bun" | "node",
11-
isBeta = false
12-
): string[] {
8+
function generateTags(version: string, runtime: "bun" | "node"): string[] {
139
const tags: string[] = []
1410
const baseImage = "ghcr.io/dcodesdev/letterspace"
1511

16-
// Add -beta suffix if this is a beta build
17-
const finalVersion = isBeta ? `${version}-beta` : version
18-
19-
// Parse version (e.g., "0.9.2")
20-
const [major, minor] = version.split(".")
21-
const isPrerelease = version.includes("-") || isBeta
12+
// Parse version (e.g., "0.9.2" or "0.9.2-beta")
13+
const versionParts = version.split(".")
14+
const major = versionParts[0].split("-")[0]
15+
const minor = versionParts[1]?.split("-")[0]
16+
const isPrerelease = version.includes("-")
2217

2318
if (runtime === "bun") {
24-
// Bun tags
25-
tags.push(`${baseImage}:${finalVersion}`)
26-
if (!isBeta) {
19+
// Bun tags (default runtime - gets clean tags)
20+
tags.push(`${baseImage}:${version}`)
21+
if (!isPrerelease) {
2722
tags.push(`${baseImage}:${major}.${minor}`)
2823
tags.push(`${baseImage}:${major}`)
29-
}
30-
31-
if (!isPrerelease) {
3224
tags.push(`${baseImage}:latest`)
3325
tags.push(`${baseImage}:bun`)
3426
}
3527
} else {
36-
// Node tags
37-
tags.push(`${baseImage}:${finalVersion}-node`)
38-
if (!isBeta) {
28+
// Node tags (always suffixed with -node, never gets latest)
29+
tags.push(`${baseImage}:${version}-node`)
30+
if (!isPrerelease) {
3931
tags.push(`${baseImage}:${major}.${minor}-node`)
4032
tags.push(`${baseImage}:${major}-node`)
41-
}
42-
43-
if (!isPrerelease) {
44-
tags.push(`${baseImage}:latest-node`)
4533
tags.push(`${baseImage}:node`)
4634
}
4735
}
@@ -51,10 +39,9 @@ function generateTags(
5139

5240
function main() {
5341
const runtime = process.argv[2] as "bun" | "node"
54-
const isBeta = process.argv[3] === "--beta"
5542

5643
if (!runtime || !["bun", "node"].includes(runtime)) {
57-
console.error("Usage: bun gen-container-img-tags.ts <bun|node> [--beta]")
44+
console.error("Usage: bun gen-container-img-tags.ts <bun|node>")
5845
process.exit(1)
5946
}
6047

@@ -64,7 +51,7 @@ function main() {
6451
readFileSync(packageJsonPath, "utf-8")
6552
)
6653

67-
const tags = generateTags(packageJson.version, runtime, isBeta)
54+
const tags = generateTags(packageJson.version, runtime)
6855
console.log(tags.join(","))
6956
} catch (error) {
7057
console.error("Error reading package.json:", error)

0 commit comments

Comments
 (0)