Skip to content

Commit 425e4da

Browse files
committed
feat: Migrate pvcviewer controller publish action
Signed-off-by: noa limoy <[email protected]>
1 parent 5f191bc commit 425e4da

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Build & Publish PVCViewer Controller Docker image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- v*-branch
8+
paths:
9+
- components/pvcviewer-controller/**
10+
- components/common/**
11+
- releasing/version/VERSION
12+
13+
env:
14+
#IMG: ghcr.io/kubeflow/notebooks/pvcviewer-controller
15+
IMG: ghcr.io/Noa-limoy/notebooks/pvcviewer-controller
16+
ARCH: linux/amd64,linux/ppc64le,linux/arm64/v8
17+
18+
jobs:
19+
push_to_registry:
20+
name: Build & Push image to GHCR
21+
runs-on: ubuntu-22.04
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- uses: dorny/paths-filter@v3
27+
id: filter
28+
with:
29+
base: ${{ github.ref }}
30+
filters: |
31+
version:
32+
- 'releasing/version/VERSION'
33+
34+
# 🔹 Added for testing compatibility with DockerHub and GHCR
35+
- name: Set registry and credentials # Added for testing
36+
id: registry
37+
run: |
38+
if [[ "${GITHUB_REPOSITORY}" == "kubeflow/notebooks" ]]; then
39+
echo "registry=ghcr.io" >> $GITHUB_OUTPUT
40+
echo "username=${{ github.actor }}" >> $GITHUB_OUTPUT
41+
echo "password=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_OUTPUT
42+
echo "image=ghcr.io/kubeflow/notebooks/pvcviewer-controller" >> $GITHUB_OUTPUT
43+
else
44+
echo "registry=ghcr.io" >> $GITHUB_OUTPUT
45+
echo "username=${{ secrets.FORK_REGISTRY_USERNAME }}" >> $GITHUB_OUTPUT
46+
echo "password=${{ secrets.FORK_REGISTRY_PASSWORD }}" >> $GITHUB_OUTPUT
47+
echo "image=${{ format('ghcr.io/{0}/pvcviewer-controller', secrets.FORK_REGISTRY_USERNAME) }}" >> $GITHUB_OUTPUT
48+
fi
49+
50+
# 🔹 GHCR login (works if using GitHub Packages)
51+
- name: Login to registry
52+
uses: docker/login-action@v3
53+
with:
54+
registry: ${{ steps.registry.outputs.registry }}
55+
username: ${{ steps.registry.outputs.username }}
56+
password: ${{ steps.registry.outputs.password }}
57+
58+
- name: Setup Docker Buildx
59+
uses: docker/setup-buildx-action@v3
60+
61+
- name: Build and push multi-arch docker image
62+
run: |
63+
cd components/pvcviewer-controller
64+
ARCH=linux/amd64 make docker-build-multi-arch
65+
ARCH=linux/ppc64le make docker-build-multi-arch
66+
ARCH=linux/arm64/v8 make docker-build-multi-arch
67+
make docker-build-push-multi-arch
68+
69+
- name: Build and push latest multi-arch docker image
70+
if: github.ref == 'refs/heads/main'
71+
run: |
72+
export TAG=latest
73+
cd components/pvcviewer-controller
74+
make docker-build-push-multi-arch
75+
76+
- name: Build and push multi-arch docker image on Version change
77+
id: version
78+
if: steps.filter.outputs.version == 'true'
79+
run: |
80+
export TAG=$(cat releasing/version/VERSION)
81+
cd components/pvcviewer-controller
82+
make docker-build-push-multi-arch

0 commit comments

Comments
 (0)