diff --git a/.github/workflows/dockerhub-latest.yml b/.github/workflows/dockerhub-latest.yml new file mode 100644 index 00000000..521126bf --- /dev/null +++ b/.github/workflows/dockerhub-latest.yml @@ -0,0 +1,29 @@ +name: Build and push latest images to DockerHub + +on: + push: + branches: ["main", "ci-test"] + +permissions: + packages: write + +jobs: + publish-images-to-dockerhub: + name: Publish to DockerHub + if: ${{ github.repository == 'kubewharf/kubeadmiral' }} + runs-on: [ubuntu-latest] + steps: + - name: checkout code + uses: actions/checkout@v3 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USER_NAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and publish images + env: + REGISTRY: kubewharf + TAG: latest + run: make upload-images diff --git a/.github/workflows/dokcerhub-released.yml b/.github/workflows/dokcerhub-released.yml new file mode 100644 index 00000000..9a259f43 --- /dev/null +++ b/.github/workflows/dokcerhub-released.yml @@ -0,0 +1,30 @@ +name: Build and push released images to DockerHub + +on: + release: + types: + - published + +permissions: + packages: write + +jobs: + publish-images-to-dockerhub: + name: Publish to DockerHub + if: ${{ github.repository == 'kubewharf/kubeadmiral' }} + runs-on: [ubuntu-latest] + steps: + - name: checkout code + uses: actions/checkout@v3 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USER_NAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and publish images + env: + REGISTRY: kubewharf + TAG: ${{ github.ref_name }} + run: make upload-images diff --git a/Makefile b/Makefile index 54adfb64..329b935c 100644 --- a/Makefile +++ b/Makefile @@ -168,3 +168,8 @@ test: .PHONY: e2e e2e: ginkgo run -race -tags=e2e $(EXTRA_GINKGO_FLAGS) test/e2e -- --kubeconfig=$(KUBECONFIG) $(EXTRA_E2E_FLAGS) + +upload-images: images + @echo "push images to $(REGISTRY)" + docker push ${REGISTRY}/kubeadmiral-controller-manager:${TAG} + docker push ${REGISTRY}/kubeadmiral-hpa-aggregator:${TAG}