Skip to content

Commit

Permalink
Update inputs of ZE Theia workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Timothy Johnson <[email protected]>
  • Loading branch information
t1m0thyj committed Jun 21, 2024
1 parent 7a746e2 commit c7b4067
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ze-theia-slim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ on:
- .github/workflows/docker-reusable.yaml
workflow_dispatch:
inputs:
theia-version:
description: "Specify Theia version (e.g., 1.37)"
default: "latest"
docker-tags:
description: "Docker tags to build (e.g., 1.37 latest)"
default: "next"
required: false
type: string
deploy:
Expand All @@ -33,7 +33,7 @@ jobs:

- name: Get Theia version
id: load-env
run: node ze/theia-slim/getTheiaVersion.js ${{ inputs.theia-version || 'next' }}
run: node ze/theia-slim/getTheiaVersion.js ${{ inputs.docker-tags }}

build-and-deploy:
needs: setup
Expand Down
26 changes: 14 additions & 12 deletions ze/theia-slim/getTheiaVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,24 @@ async function getTheiaReleases() {
(async () => {
const dockerTags = [];
let theiaVersion;
if (process.argv[2] == null || process.argv[2] === "latest") {
// "latest" tag (default) = latest community release of Theia
const release = (await getTheiaReleases()).find(obj => obj.body.includes("community release"));
theiaVersion = "1.49.1"; // release.tag_name.slice(1);
dockerTags.push(...expandImageTag("latest"),
...expandImageTag(theiaVersion.slice(0, theiaVersion.lastIndexOf("."))));
} else if (process.argv[2] === "next") {
if (process.argv[2] == null || process.argv[2] === "next") {
// "next" tag = latest version of Theia on master branch
theiaVersion = "latest";
dockerTags.push(...expandImageTag("next"));
} else {
// "1.XX" tag = older community release of Theia
const release = (await getTheiaReleases()).find(obj => obj.body.includes("community release") &&
obj.tag_name.startsWith(`v${process.argv[2]}`));
theiaVersion = release.tag_name.slice(1);
dockerTags.push(...expandImageTag(theiaVersion.slice(0, theiaVersion.lastIndexOf("."))));
// "1.XX" and "latest" tag = community releases of Theia
for (const tagName of process.argv.slice(2)) {
if (tagName === "latest") {
dockerTags.push(...expandImageTag("latest"));
} else {
const release = (await getTheiaReleases()).find(obj => obj.tag_name.startsWith("v" + tagName));
theiaVersion = release?.tag_name.slice(1);
dockerTags.push(...expandImageTag(tagName));
}
};
}
if (theiaVersion == null) {
throw new Error("Could not find Theia version that matches these tags: " + process.argv.slice(2).join(" "));
}
fs.appendFileSync(outputPath, "DOCKER_TAGS<<EOF\n" + dockerTags.join("\n") + "\nEOF\n");
fs.appendFileSync(outputPath, `THEIA_VERSION=${theiaVersion}\n`);
Expand Down

0 comments on commit c7b4067

Please sign in to comment.