Skip to content

Commit

Permalink
Adapt action to work with Previews
Browse files Browse the repository at this point in the history
  • Loading branch information
ianpittwood committed Apr 12, 2024
1 parent 835f700 commit fd6f3a3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 23 deletions.
9 changes: 8 additions & 1 deletion .github/actions/bake-test-push/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ inputs:
description: Target or group to bake
required: true
type: string
bakefile:
description: Path to the bakefile
required: true
default: "docker-bake.hcl"
type: string
env-vars:
description: A semicolon delimited list of environment variables to set as overrides for the bake definition
required: false
Expand Down Expand Up @@ -99,14 +104,16 @@ runs:
with:
targets: "${{ inputs.target }}"
push: false
files: ${{ inputs.bakefile }}

- name: Test
shell: bash
run: |
just test "${{ inputs.target }}"
just test "${{ inputs.target }}" "${{ inputs.bakefile }}"
- name: Push - ${{ inputs.push-image }}
uses: docker/bake-action@v4
with:
targets: "${{ inputs.target }}"
push: ${{ inputs.push-image }}
files: ${{ inputs.bakefile }}
29 changes: 9 additions & 20 deletions .github/workflows/build-bake-preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,26 +96,15 @@ jobs:
with:
buildkitd-config: ./share/buildkitd.toml

- name: Build
id: build
uses: docker/bake-action@v4
with:
targets: ${{ env.target }}
push: false
files: docker-bake.preview.hcl

- name: Test
run: |
just preview-test "${{ env.target }}"
- name: Push
id: push
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/dev-rspm' }}
uses: docker/bake-action@v4
with:
targets: ${{ env.target }}
push: true
files: docker-bake.preview.hcl
- name: Build, Test, and Push
uses: ./.github/actions/bake-test-push
with:
target: ${{ env.target }}
bakefile: docker-bake.preview.hcl
push-image: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/dev-rspm' }}
ghcr-token: ${{ secrets.GITHUB_TOKEN }}
dockerhub-username: ${{ secrets.DOCKER_HUB_USERNAME }}
dockerhub-token: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Export artifacts
run: |
Expand Down
4 changes: 2 additions & 2 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ preview-plan branch="$(git branch --show-current)":
# Run tests

# just test workbench
test target="default":
python3 {{justfile_directory()}}/tools/test_bake_artifacts.py --target "{{target}}"
test target="default" file="docker-bake.hcl":
python3 {{justfile_directory()}}/tools/test_bake_artifacts.py --target "{{target}}" --file "{{file}}"

# just preview-test connect dev
preview-test target="default" branch="$(git branch --show-current)":
Expand Down

0 comments on commit fd6f3a3

Please sign in to comment.