Skip to content

Commit

Permalink
use env var for build arg
Browse files Browse the repository at this point in the history
  • Loading branch information
sholdee committed Jul 9, 2024
1 parent 0387f1a commit ed550a8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ jobs:
restore-keys: |
${{ runner.os }}-buildx-
- name: Set env
run: echo "DISTROLESS_IMAGE=$(grep DISTROLESS_IMAGE image.env | cut -d '=' -f2)" >> $GITHUB_ENV

- name: Build Docker image
uses: docker/build-push-action@v6
with:
Expand All @@ -50,7 +53,7 @@ jobs:
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
build-args: |
DISTROLESS_IMAGE=$(grep DISTROLESS_IMAGE image.env | cut -d '=' -f2)
DISTROLESS_IMAGE=${{ env.DISTROLESS_IMAGE }}
push:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -104,6 +107,9 @@ jobs:
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Set env
run: echo "DISTROLESS_IMAGE=$(grep DISTROLESS_IMAGE image.env | cut -d '=' -f2)" >> $GITHUB_ENV

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
Expand All @@ -115,7 +121,7 @@ jobs:
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
build-args: |
DISTROLESS_IMAGE=$(grep DISTROLESS_IMAGE image.env | cut -d '=' -f2)
DISTROLESS_IMAGE=${{ env.DISTROLESS_IMAGE }}
- name: Sign the images with GitHub OIDC Token
if: github.event_name != 'pull_request'
Expand Down

0 comments on commit ed550a8

Please sign in to comment.