From b3a611e7ad4450c4c94e450114a56c046a292e3b Mon Sep 17 00:00:00 2001 From: Michael Albert <37796947+awesome-michael@users.noreply.github.com> Date: Tue, 24 Jan 2023 22:13:56 +0100 Subject: [PATCH] Create test-docker-image.yml Change-Id: I2a350b2a33233c9a271739643acc0887558cc52e --- .github/workflows/test-docker-image.yml | 51 +++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/test-docker-image.yml diff --git a/.github/workflows/test-docker-image.yml b/.github/workflows/test-docker-image.yml new file mode 100644 index 0000000..8136bb7 --- /dev/null +++ b/.github/workflows/test-docker-image.yml @@ -0,0 +1,51 @@ +name: Test docker image creation + +on: + push: + # Sequence of patterns matched against refs/heads + # prettier-ignore + branches: + # Push events on branch fix_docker_cd + - fix_docker_cd + # Sequence of patterns matched against refs/tags + tags: + - '[0-9]+\.[0-9]+\.[0-9]+' # Push events to 0.X.X tag + +jobs: + docker: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Calculate docker image tag + id: set-tag + run: | + case "${GITHUB_REF}" in + refs/heads/master|refs/heads/main) + tag=latest + ;; + refs/tags/*) + tag=${GITHUB_REF#refs/tags/} + ;; + *) + tag=${GITHUB_SHA} + ;; + esac + echo "::set-output name=tag::$tag" + - name: Build and Push Tag + uses: docker/build-push-action@v3 + with: + context: . + push: false + tags: "awesometechnologies/synapse-admin:${{ steps.set-tag.outputs.tag }}" + platforms: linux/amd64,linux/arm64