From 42ee11c85521d8ee1233608bca593a2b4bb4b27b Mon Sep 17 00:00:00 2001 From: xzchaoo Date: Wed, 27 Dec 2023 20:58:00 +0800 Subject: [PATCH] ci: add docker release action --- .github/workflows/upload-docker-image.yaml | 33 +++++++++++++++++++ .../upload-release-docker-image.yaml | 32 ++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 .github/workflows/upload-docker-image.yaml create mode 100644 .github/workflows/upload-release-docker-image.yaml diff --git a/.github/workflows/upload-docker-image.yaml b/.github/workflows/upload-docker-image.yaml new file mode 100644 index 000000000..7e0c33e2d --- /dev/null +++ b/.github/workflows/upload-docker-image.yaml @@ -0,0 +1,33 @@ +name: Upload docker image + +on: + push: + branches: [ "main" ] + workflow_dispatch: { } + +concurrency: + group: holoinsight-agent-upload-docker-image + cancel-in-progress: true + +jobs: + upload-docker-image: + runs-on: ubuntu-latest + if: (github.repository == 'traas-stack/holoinsight') + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 8 + uses: actions/setup-java@v3 + with: + java-version: '8' + distribution: 'temurin' + cache: maven + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Upload HoloInsight Docker Image + shell: bash + run: | + docker buildx create --use + tag=latest ./scripts/docker/buildx.sh diff --git a/.github/workflows/upload-release-docker-image.yaml b/.github/workflows/upload-release-docker-image.yaml new file mode 100644 index 000000000..7a97dbec6 --- /dev/null +++ b/.github/workflows/upload-release-docker-image.yaml @@ -0,0 +1,32 @@ +name: Upload release docker image + +on: + release: + types: [ published ] + +concurrency: + group: holoinsight-agent-upload-release-docker-image-${{ github.event.release.tag_name }} + cancel-in-progress: true + +jobs: + upload-release-docker-image: + runs-on: ubuntu-latest + if: (github.repository == 'traas-stack/holoinsight') && startsWith( github.event.release.tag_bname, "v" ) + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 8 + uses: actions/setup-java@v3 + with: + java-version: '8' + distribution: 'temurin' + cache: maven + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Upload HoloInsight Docker Image + shell: bash + run: | + docker buildx create --use + tag=${GITHUB_REF_NAME:1} ./scripts/docker/buildx.sh