Skip to content

Commit e502d5f

Browse files
committed
publish after all builds
1 parent 6cfe497 commit e502d5f

File tree

3 files changed

+33
-94
lines changed

3 files changed

+33
-94
lines changed

.github/workflows/ci.yaml

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,8 @@ concurrency:
1212

1313
jobs:
1414
build-x86_64:
15-
name: 'Check, Build, Test, Publish DevContainer (x86_64)'
15+
name: 'DevContainer (x86_64)'
1616
runs-on: ubuntu-24.04
17-
permissions:
18-
contents: read
19-
packages: write
20-
id-token: write
2117

2218
steps:
2319
- name: Checkout (GitHub)
@@ -31,7 +27,7 @@ jobs:
3127
password: ${{ secrets.GITHUB_TOKEN }}
3228

3329
# Use .devcontainer from THIS repo for building and testing
34-
- name: Check, Build, Test, Publish
30+
- name: Check, Build, Test
3531
uses: devcontainers/ci@v0.3
3632
with:
3733
# The .devcontainer is never published as pre-built container.
@@ -52,22 +48,9 @@ jobs:
5248
# Test
5349
./scripts/test.sh
5450
55-
# Optionally: Publish
56-
# We do not use the push feature of devcontainers/ci here, since that would push the wrong container.
57-
# Instead, we use the publish script which pushes the correct container (residing in src/s-core-devcontainer).
58-
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
59-
# manually login to ghcr.io for publishing
60-
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
61-
./scripts/publish.sh "main"
62-
fi
63-
6451
build-arm64:
65-
name: 'Check, Build, Test, Publish DevContainer (arm64)'
52+
name: 'DevContainer (arm64)'
6653
runs-on: ubuntu-24.04-arm
67-
permissions:
68-
contents: read
69-
packages: write
70-
id-token: write
7154

7255
steps:
7356
- name: Checkout (GitHub)
@@ -81,7 +64,7 @@ jobs:
8164
password: ${{ secrets.GITHUB_TOKEN }}
8265

8366
# Use .devcontainer from THIS repo for building and testing
84-
- name: Check, Build, Test, Publish
67+
- name: Check, Build, Test
8568
uses: devcontainers/ci@v0.3
8669
with:
8770
# The .devcontainer is never published as pre-built container.
@@ -102,6 +85,34 @@ jobs:
10285
# Test
10386
./scripts/test.sh
10487
88+
publish:
89+
needs: [build-arm64, build-x86_64]
90+
name: 'Publish'
91+
runs-on: ubuntu-24.04
92+
permissions:
93+
contents: read
94+
packages: write
95+
id-token: write
96+
steps:
97+
- name: Checkout (GitHub)
98+
uses: actions/checkout@v3
99+
100+
- name: Login to GitHub Container Registry
101+
uses: docker/login-action@v2
102+
with:
103+
registry: ghcr.io
104+
username: ${{ github.actor }}
105+
password: ${{ secrets.GITHUB_TOKEN }}
106+
107+
- name: Publish
108+
uses: devcontainers/ci@v0.3
109+
with:
110+
# The .devcontainer is never published as pre-built container.
111+
# We want to only use it for building and testing the actual container, which resides in src/s-core-devcontainer.
112+
push: "never"
113+
runCmd: |
114+
set -eux pipefail
115+
105116
# Optionally: Publish
106117
# We do not use the push feature of devcontainers/ci here, since that would push the wrong container.
107118
# Instead, we use the publish script which pushes the correct container (residing in src/s-core-devcontainer).

scripts/publish-arm.sh

Lines changed: 0 additions & 50 deletions
This file was deleted.

scripts/publish.sh

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,7 @@ for LABEL in "$@"; do
1212
done
1313

1414
# Define target architectures
15-
ARCHITECTURES=("amd64")
16-
17-
# Build and push for each architecture, creating all requested tags
18-
for ARCH in "${ARCHITECTURES[@]}"; do
19-
echo "Building all tags (${LABELS[@]}) for architecture: ${ARCH}"
20-
21-
# Prepare image names with tags (each tag includes a label and an architecture)
22-
IMAGES=()
23-
for LABEL in "${LABELS[@]}"; do
24-
IMAGES+=("--image-name \"ghcr.io/eclipse-score/devcontainer:${LABEL}-${ARCH}\"")
25-
done
26-
27-
# Prepare devcontainer build command
28-
DEVCONTAINER_CALL="devcontainer build --push --workspace-folder src/s-core-devcontainer --cache-from ghcr.io/eclipse-score/devcontainer"
29-
30-
# Append image names to the build command
31-
for IMAGE in "${IMAGES[@]}"; do
32-
DEVCONTAINER_CALL+=" $IMAGE"
33-
done
34-
35-
# Execute the build and push all tags for the specific architecture
36-
eval "$DEVCONTAINER_CALL --platform linux/${ARCH}"
37-
done
15+
ARCHITECTURES=("amd64", "arm64")
3816

3917
# Create and push the merged multiarch manifest for each tag; each tag combines all architecture-specific tags into one tag
4018
for LABEL in "${LABELS[@]}"; do

0 commit comments

Comments
 (0)