Skip to content

Commit

Permalink
fix: Minor fix to docker bake github actions
Browse files Browse the repository at this point in the history
Signed-off-by: Diwank Singh Tomer <[email protected]>
  • Loading branch information
creatorrr committed Sep 28, 2024
1 parent 2a82893 commit 0e1a5c6
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 16 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/dev-push-to-hub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set branch name
id: variables
run: |
echo "branch_name=$(echo ${GITHUB_REF#refs/heads/} | tr '/' '-')" >> $GITHUB_OUTPUT
echo "git_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand All @@ -29,7 +23,7 @@ jobs:
password: "${{ secrets.DOCKER_HUB_PASSWORD }}"

- name: Build and push agent images
uses: docker/bake-action@v3
uses: docker/bake-action@v5
with:
files: |
./docker-bake.hcl
Expand All @@ -38,8 +32,8 @@ jobs:
set: |
*.cache-from=type=gha
*.cache-to=type=gha,mode=max
*.args.TAG=${{ steps.variables.outputs.branch_name }}
*.args.GIT_SHA=${{ steps.variables.outputs.git_sha }}
*.args.TAG=dev
*.args.GIT_SHA=${{ github.sha }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/docker-bake-on-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Bake images on PR
run-name: ${{ github.actor }} is baking images

on:
pull_request:

jobs:
Bake-Images:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: julepai
password: "${{ secrets.DOCKER_HUB_PASSWORD }}"

- name: Bake images
uses: docker/bake-action@v5
with:
files: |
./docker-bake.hcl
targets: agents-api
push: false
set: |
*.cache-from=type=gha
*.cache-to=type=gha,mode=max
*.args.TAG=pr-${{ github.ref_name }}
*.args.GIT_SHA=${{ github.sha }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/dev' }}
9 changes: 2 additions & 7 deletions .github/workflows/main-push-to-hub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set git sha
id: variables
run: |
echo "git_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand All @@ -28,7 +23,7 @@ jobs:
password: "${{ secrets.DOCKER_HUB_PASSWORD }}"

- name: Build and push agent images
uses: docker/bake-action@v3
uses: docker/bake-action@v5
with:
files: |
./docker-bake.hcl
Expand All @@ -38,7 +33,7 @@ jobs:
*.cache-from=type=gha
*.cache-to=type=gha,mode=max
*.args.TAG=latest
*.args.GIT_SHA=${{ steps.variables.outputs.git_sha }}
*.args.GIT_SHA=${{ github.sha }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down

0 comments on commit 0e1a5c6

Please sign in to comment.