Skip to content

Commit cb433e2

Browse files
committed
Fix release download
1 parent 96698c7 commit cb433e2

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

.github/workflows/image-build.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ jobs:
2020
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
2121
- name: Set up Docker Buildx
2222
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3
23-
- name: Fetch latest FE commit SHA
24-
id: fetch_commit_fe_sha
23+
- name: Fetch latest release URL
24+
id: fetch_release_url
2525
run: |
26-
echo "LATEST_RELEASE=$(curl -s "https://api.github.com/repos/stacklok/codegate-ui/releases/latest" | grep '"zipball_url":' | cut -d '"' -f 4)" >> $GITHUB_ENV
26+
echo "LATEST_RELEASE=$(curl -s "https://api.github.com/repos/stacklok/codegate-ui/releases/latest" | jq -r '.zipball_url')" >> $GITHUB_ENV
2727
- name: Test build on x86
2828
id: docker_build
2929
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v5

Dockerfile

+12-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,18 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
3535

3636
WORKDIR /usr/src/
3737

38-
# Set the release URL (this should be static and not change often) and download latest
39-
RUN curl -s https://api.github.com/repos/stacklok/codegate-ui/releases/latest | jq -r '.zipball_url' | xargs curl -L -o main.zip
38+
# Set build arg for latest release URL (optional)
39+
ARG LATEST_RELEASE
40+
41+
# Download the latest release - if LATEST_RELEASE is provided use it, otherwise fetch from API
42+
RUN if [ -n "$LATEST_RELEASE" ]; then \
43+
echo "Using provided release URL" && \
44+
curl -L -o main.zip "${LATEST_RELEASE}"; \
45+
else \
46+
echo "Fetching latest release URL" && \
47+
curl -s https://api.github.com/repos/stacklok/codegate-ui/releases/latest | \
48+
jq -r '.zipball_url' | xargs curl -L -o main.zip; \
49+
fi
4050

4151
# Extract the downloaded zip file
4252
RUN unzip main.zip

0 commit comments

Comments
 (0)