Skip to content

Commit

Permalink
test build_image workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
CubicrootXYZ committed Oct 20, 2024
1 parent 541a8aa commit 7307f22
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/build_image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ on:
image_name:
required: true
type: string
static_tag:
required: false
type: string
default: ""
secrets:
dockerhub_user:
required: true
Expand Down Expand Up @@ -38,4 +42,10 @@ jobs:
- name: Push image with tag
if: "startsWith(github.ref, 'refs/tags/')"
run: docker push ${{ inputs.image_name }}:${{ github.ref_name }}
- name: Tag image with static tag
if: "${{ inputs.static_tag != '' }}"
run: docker tag ${{ inputs.image_name }}:${{ github.sha }} ${{ inputs.image_name }}:${{ inputs.static_tag }}
- name: Push image with static tag
if: "${{ inputs.static_tag != '' }}"
run: docker push ${{ inputs.image_name }}:${{ inputs.static_tag }}

11 changes: 11 additions & 0 deletions .github/workflows/build_image_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
on: push

jobs:
build_image_test:
uses: ./.github/workflows/build_image.yaml
with:
docker_file_path: "tests/build_image/"
image_name: cubicrootxyz/workflows-test
static_tag: beta
dockerhub_user: "${{ secrets.DOCKERHUB_USERNAME}}"
dockerhub_token: "${{ secrets.DOCKERHUB_TOKEN}}"
1 change: 1 addition & 0 deletions tests/build_image/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM scratch

0 comments on commit 7307f22

Please sign in to comment.