Skip to content

Commit

Permalink
wip: testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgilman committed Sep 10, 2024
1 parent e789ba7 commit d2ce1a0
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 21 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ jobs:
with:
earthly_token: ${{ secrets.earthly_token }}
forge_version: ${{ inputs.forge_version }}
- name: Run
id: run
uses: ./forge/actions/run
with:
path: ${{ matrix.earthfile }}
target_args: --container ${{ env.CONTAINER }} --tag ${{ env.TAG }}
- name: Parse Earthfile reference
id: parse
run: |
Expand All @@ -44,15 +50,10 @@ jobs:
echo "project=$PROJECT" >> $GITHUB_OUTPUT
echo "target=$TARGET" >> $GITHUB_OUTPUT
- name: Run
id: run
uses: ./forge/actions/run
with:
path: ${{ matrix.earthfile }}
target_args: --container ${{ env.CONTAINER }} --tag ${{ env.TAG }}
- name: Publish
uses: ./forge/actions/publish
with:
image: "${{ env.CONTAINER }}:${{ env.TAG }}"
project: ${{ steps.parse.outputs.project }}
skip_branch_check: "true"
target: ${{ steps.parse.outputs.target }}
45 changes: 38 additions & 7 deletions forge/actions/publish/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30516,15 +30516,46 @@ async function run() {
const container = blueprint.project.container;
const registries = blueprint.global.ci.registries;

for (const registry of registries) {
for (const tag of tags) {
const taggedImage = `${registry}/${container}:${tag}`;
if (platforms.length > 0) {
for (const registry of registries) {
for (const tag of tags) {
const pushed = [];
for (const platform of platforms) {
const existingImage = images[platform];
const taggedImage = `${registry}/${container}:${tag}_${platform.replace("/", "_")}`;

core.info(`Tagging image ${existingImage} as ${taggedImage}`);
await tagImage(existingImage, taggedImage);

core.info(`Pushing image ${taggedImage}`);
await pushImage(taggedImage);

pushed.push(taggedImage);
}

core.info(`Tagging image ${image} as ${taggedImage}`);
await tagImage(image, taggedImage);
const multiImage = `${registry}/${container}:${tag}`;
core.info(`Creating multi-platform image ${multiImage}`);
await exec.exec("docker", [
"buildx",
"create",
"--tag",
multiImage,
...pushed,
]);
}
}
} else {
const image = images["default"];
for (const registry of registries) {
for (const tag of tags) {
const taggedImage = `${registry}/${container}:${tag}`;

core.info(`Pushing image ${taggedImage}`);
await pushImage(taggedImage);
core.info(`Tagging image ${image} as ${taggedImage}`);
await tagImage(image, taggedImage);

core.info(`Pushing image ${taggedImage}`);
await pushImage(taggedImage);
}
}
}
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion forge/actions/publish/dist/index.js.map

Large diffs are not rendered by default.

45 changes: 38 additions & 7 deletions forge/actions/publish/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,46 @@ async function run() {
const container = blueprint.project.container;
const registries = blueprint.global.ci.registries;

for (const registry of registries) {
for (const tag of tags) {
const taggedImage = `${registry}/${container}:${tag}`;
if (platforms.length > 0) {
for (const registry of registries) {
for (const tag of tags) {
const pushed = [];
for (const platform of platforms) {
const existingImage = images[platform];
const taggedImage = `${registry}/${container}:${tag}_${platform.replace("/", "_")}`;

core.info(`Tagging image ${existingImage} as ${taggedImage}`);
await tagImage(existingImage, taggedImage);

core.info(`Pushing image ${taggedImage}`);
await pushImage(taggedImage);

pushed.push(taggedImage);
}

const multiImage = `${registry}/${container}:${tag}`;
core.info(`Creating multi-platform image ${multiImage}`);
await exec.exec("docker", [
"buildx",
"create",
"--tag",
multiImage,
...pushed,
]);
}
}
} else {
const image = images["default"];
for (const registry of registries) {
for (const tag of tags) {
const taggedImage = `${registry}/${container}:${tag}`;

core.info(`Tagging image ${image} as ${taggedImage}`);
await tagImage(image, taggedImage);
core.info(`Tagging image ${image} as ${taggedImage}`);
await tagImage(image, taggedImage);

core.info(`Pushing image ${taggedImage}`);
await pushImage(taggedImage);
core.info(`Pushing image ${taggedImage}`);
await pushImage(taggedImage);
}
}
}
} catch (error) {
Expand Down

0 comments on commit d2ce1a0

Please sign in to comment.