Skip to content

Commit 6da07a6

Browse files
committed
Publish oci packages versions
1 parent 470b13b commit 6da07a6

3 files changed

Lines changed: 61 additions & 0 deletions

File tree

.github/semantic-release/.releaserc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ plugins:
99
- '@semantic-release/github'
1010
-
1111
- '@semantic-release/exec'
12+
- publishCmd: VERSION=${nextRelease.version} node publish-oci.js
1213
- successCmd: echo "tag=${nextRelease.gitTag}" >> $GITHUB_OUTPUT
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
const { execSync } = require("child_process");
2+
3+
const version = process.env.VERSION.replace(/^v/, "");
4+
const repo = process.env.GITHUB_REPOSITORY.toLowerCase();
5+
const imagePath = `ghcr.io/${repo}`;
6+
7+
const ociTypes = ["", "-full", "-dev", "-dev-full", "-v3", "-v3-full"];
8+
9+
ociTypes.forEach((ociType) => {
10+
const dockerEnv = {
11+
...process.env,
12+
JOBS_ENABLED: ociType.includes("-full") ? "true" : "",
13+
ELASTIC_ENABLED: ociType.includes("-full") ? "true" : "",
14+
LDAP_ENABLED: ociType.includes("-full") ? "true" : "",
15+
OIDC_ENABLED: ociType.includes("-full") ? "true" : "",
16+
COMPOSE_PROFILES: ociType.includes("-full") ? "*" : "",
17+
DEV: ociType.includes("-dev") ? "true" : "",
18+
BE_VERSION: ociType.includes("-v3") ? "v3" : "v4",
19+
};
20+
21+
try {
22+
// 1. Resolve Compose
23+
execSync(
24+
"docker compose -f ../../compose.yaml config --no-path-resolution > resolved-compose.yaml",
25+
{
26+
env: dockerEnv,
27+
},
28+
);
29+
30+
// 2. Inline & Escape $ (Safe Node-style string replacement)
31+
execSync(
32+
"yq -i \"(.configs[] | select(has(\\\"file\\\"))) |= (.content = (load_str(.file) | split(\\\"$\\\") | join(\\\"$$\\\")) | del(.file))\" resolved-compose.yaml",
33+
{ stdio: "inherit" }
34+
);
35+
36+
// 3. Publish
37+
const ociTags = [
38+
`${imagePath}:${version}${ociType}`,
39+
`${imagePath}:latest${ociType}`,
40+
];
41+
ociTags.forEach((ociTag) => {
42+
execSync(
43+
`yes | docker compose -f resolved-compose.yaml publish --resolve-image-digests --with-env --yes ${ociTag}`,
44+
{
45+
env: dockerEnv,
46+
stdio: "inherit",
47+
},
48+
);
49+
});
50+
} catch {
51+
process.exit(1);
52+
}
53+
});

.github/workflows/semantic_release.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
contents: write
1313
issues: write
1414
pull-requests: write
15+
packages: write
1516
defaults:
1617
run:
1718
working-directory: .github/semantic-release
@@ -26,6 +27,12 @@ jobs:
2627
node-version: 24
2728
- name: Install dependencies
2829
run: npm install --no-package-lock
30+
- name: Log in to GHCR
31+
uses: docker/login-action@v3
32+
with:
33+
registry: ghcr.io
34+
username: ${{ github.actor }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
2936
- name: Release
3037
id: semantic-release
3138
env:

0 commit comments

Comments
 (0)