From a8d3018d23dc28eb9adb1129b0aa92aee7e3880c Mon Sep 17 00:00:00 2001 From: SumisuMC Date: Mon, 14 Oct 2024 16:56:48 +0000 Subject: [PATCH] Add .github/actions/common-docker-build/action.yml --- .../actions/common-docker-build/action.yml | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/actions/common-docker-build/action.yml diff --git a/.github/actions/common-docker-build/action.yml b/.github/actions/common-docker-build/action.yml new file mode 100644 index 0000000..0a7995a --- /dev/null +++ b/.github/actions/common-docker-build/action.yml @@ -0,0 +1,54 @@ +name: 'Common Docker Build' + +description: 'Reusable action for building and pushing Docker images' + +inputs: + build_tags: + description: 'Tags for the Docker build' + required: true + manifest_tags: + description: 'Tags for the Docker manifest' + required: true + flavor: + description: 'Flavor for the Docker manifest' + required: true + docker_username: + description: 'DockerHub username' + required: true + docker_password: + description: 'DockerHub password' + required: true + +runs: + using: 'composite' + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ inputs.docker_username }} + password: ${{ inputs.docker_password }} + + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ inputs.build_tags }} + platforms: linux/amd64, linux/arm64/v8, linux/arm/v7 + + - name: Create and push manifest + uses: docker/metadata-action@v3 + with: + images: csmith1865/obscreen + tags: ${{ inputs.manifest_tags }} + flavor: ${{ inputs.flavor }}