Skip to content

Commit

Permalink
Merge pull request #326 from kubewharf/ci-test
Browse files Browse the repository at this point in the history
feat: push images to dockerhub
  • Loading branch information
mrlihanbo authored Jun 5, 2024
2 parents 79c6330 + da9d9ce commit 20c90a8
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/dockerhub-latest.yml
Original file line number Diff line number Diff line change
@@ -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
30 changes: 30 additions & 0 deletions .github/workflows/dokcerhub-released.yml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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}

0 comments on commit 20c90a8

Please sign in to comment.