From a12cb6dd174130d8ebd6a2115d059ba412784325 Mon Sep 17 00:00:00 2001 From: Xyphuz Date: Sun, 29 May 2022 15:59:05 +0800 Subject: [PATCH] ci: add docker image related actions --- .github/workflows/release-docker-image.yml | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/release-docker-image.yml diff --git a/.github/workflows/release-docker-image.yml b/.github/workflows/release-docker-image.yml new file mode 100644 index 0000000..cac4fd4 --- /dev/null +++ b/.github/workflows/release-docker-image.yml @@ -0,0 +1,42 @@ +name: Release Docker Image + +on: + push: + tags: + - "v*" + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + 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: Extract Tag Version + id: tag_version + run: | + echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v} + + - name: Echo Tag Version + run: echo ${{ steps.tag_version.outputs.VERSION }} + + - + name: Build and push + uses: docker/build-push-action@v3 + with: + push: true + tags: | + ${{ secrets.DOCKER_HUB_USERNAME }}/compose-viz:latest + ${{ secrets.DOCKER_HUB_USERNAME }}/compose-viz:${{ steps.tag_version.outputs.VERSION }} + cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/compose-viz:buildcache + cache-to: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/compose-viz:buildcache,mode=max