From 3ee8c8efdfea9a118bde2d03aa3d580df4976b78 Mon Sep 17 00:00:00 2001 From: cubicroot Date: Sun, 20 Oct 2024 13:34:16 +0200 Subject: [PATCH] test build_image workflow --- .github/workflows/build_image.yaml | 10 ++++++++++ .github/workflows/build_image_test.yaml | 12 ++++++++++++ tests/build_image/Dockerfile | 1 + 3 files changed, 23 insertions(+) create mode 100644 .github/workflows/build_image_test.yaml create mode 100644 tests/build_image/Dockerfile diff --git a/.github/workflows/build_image.yaml b/.github/workflows/build_image.yaml index 1884e5a..c715e6f 100644 --- a/.github/workflows/build_image.yaml +++ b/.github/workflows/build_image.yaml @@ -11,6 +11,10 @@ on: image_name: required: true type: string + static_tag: + required: false + type: string + default: "" secrets: dockerhub_user: required: true @@ -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 }} \ No newline at end of file diff --git a/.github/workflows/build_image_test.yaml b/.github/workflows/build_image_test.yaml new file mode 100644 index 0000000..82a4acf --- /dev/null +++ b/.github/workflows/build_image_test.yaml @@ -0,0 +1,12 @@ +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 + secrets: + dockerhub_user: "${{ secrets.DOCKERHUB_USERNAME }}" + dockerhub_token: "${{ secrets.DOCKERHUB_TOKEN }}" \ No newline at end of file diff --git a/tests/build_image/Dockerfile b/tests/build_image/Dockerfile new file mode 100644 index 0000000..449fd74 --- /dev/null +++ b/tests/build_image/Dockerfile @@ -0,0 +1 @@ +FROM scratch \ No newline at end of file