Skip to content

Commit ce8b149

Browse files
committed
Convert publish image secret to build secrets
1 parent 56825b0 commit ce8b149

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

.github/workflows/publish-latest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
context: .
4545
push: true
4646
# Pass build arguments for the GitHub credentials
47-
build-args: |
47+
secrets: |
4848
GH_USER_NAME=${{ secrets.GH_USER_NAME }}
4949
GH_USER_TOKEN=${{ secrets.GHCR_TOKEN }}
5050
tags: |

.github/workflows/publish-tagged.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
context: .
4646
push: true
4747
# Pass build arguments for the GitHub credentials
48-
build-args: |
48+
secrets: |
4949
GH_USER_NAME=${{ secrets.GH_USER_NAME }}
5050
GH_USER_TOKEN=${{ secrets.GHCR_TOKEN }}
5151
tags: |

Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ FROM golang:1.23 AS builder
88
ADD . /src
99
WORKDIR /src
1010
RUN cd /src && echo $(ls -1 /src)
11-
ARG GH_USER_NAME
12-
ARG GH_USER_TOKEN
13-
RUN go env -w GOPRIVATE=github.com/sprintertech
14-
RUN git config --global url."https://$GH_USER_NAME:[email protected]".insteadOf "https://github.com"
11+
RUN --mount=type=secret,id=GH_USER_NAME \
12+
--mount=type=secret,id=GH_USER_TOKEN \
13+
GH_USER_NAME=$(cat /run/secrets/GH_USER_NAME) && \
14+
GH_USER_TOKEN=$(cat /run/secrets/GH_USER_TOKEN) && \
15+
go env -w GOPRIVATE=github.com/sprintertech && \
16+
git config --global url."https://${GH_USER_NAME}:${GH_USER_TOKEN}@github.com".insteadOf "https://github.com"
1517
RUN go mod download
1618
RUN go build -ldflags "-X google.golang.org/protobuf/reflect/protoregistry.conflictPolicy=ignore -X github.com/sprintertech/sprinter-signing/app.Version=$(sed -n '0,/## \[\([0-9.]*\)\]/s/.*\[\([0-9.]*\)\].*/\1/p' CHANGELOG.md)" -o /signing .
1719

0 commit comments

Comments
 (0)