1919 required : false
2020
2121env :
22- DOCKER_REGISTRY : us-east1-docker.pkg.dev
23- DOCKER_IMAGE : ${{ secrets.GKE_PROJECT }}/webui/nuxeo-web-ui
24- GKE_CLUSTER : jx-prod
25- GKE_ZONE : us-east1-b
22+ REGISTRY : docker-internal.packages.nuxeo.com
23+ REPOSITORY : nuxeo/nuxeo-web-ui
2624
2725jobs :
2826 id :
3735 needs : id
3836 name : Setup
3937 outputs :
40- url : ${{ steps.preview.outputs.url }}
38+ image : ${{ steps.preview.outputs.image }}
4139 if : >
4240 (github.event.action == 'labeled' && github.event.label.name == 'preview') ||
4341 contains(github.event.pull_request.labels.*.name, 'preview') ||
7977 - name : Prepare environment
8078 run : |
8179 echo "VERSION=$(npx -c 'echo "$npm_package_version"')-$BRANCH_NAME_SANITIZED" >> $GITHUB_ENV
82- echo "PREVIEW_NAMESPACE=$(printf '%.53s' $(echo nuxeo-web-ui-$(echo $BRANCH_NAME_SANITIZED)))" >> $GITHUB_ENV
8380
8481 - name : Determine nuxeo-elements branch to use
8582 id : pick_nuxeo_elements_branch
@@ -112,12 +109,12 @@ jobs:
112109 - name : Set up Docker Buildx
113110 uses : docker/setup-buildx-action@v4
114111
115- - name : Login to DockerHub
112+ - name : Login to Docker registry
116113 uses : docker/login-action@v4
117114 with :
118- registry : ${{ env.DOCKER_REGISTRY }}
119- username : _json_key
120- password : ${{ secrets.GKE_SA_KEY }}
115+ registry : ${{ env.REGISTRY }}
116+ username : ${{ secrets.NUXEO_DOCKER_USERNAME }}
117+ password : ${{ secrets.NUXEO_DOCKER_TOKEN }}
121118
122119 - name : Build and push server image
123120 uses : docker/build-push-action@v7
@@ -126,7 +123,7 @@ jobs:
126123 pull : true
127124 push : true
128125 file : server/Dockerfile
129- tags : ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}/server:${{ env.VERSION }}
126+ tags : ${{ env.REGISTRY }}/${{ env.REPOSITORY }}/server:${{ env.VERSION }}
130127
131128 - name : Build and push image
132129 uses : docker/build-push-action@v7
@@ -135,45 +132,14 @@ jobs:
135132 pull : true
136133 push : true
137134 file : Dockerfile
138- tags : ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:${{ env.VERSION }}
139- build-args : SERVER_IMAGE=${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}/server:${{ env.VERSION }}
135+ tags : ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:${{ env.VERSION }}
136+ build-args : SERVER_IMAGE=${{ env.REGISTRY }}/${{ env.REPOSITORY }}/server:${{ env.VERSION }}
140137
141- - name : Authenticate to Google Cloud
142- uses : google-github-actions/auth@v3
143- with :
144- credentials_json : ${{ secrets.GKE_SA_KEY }}
145-
146- - name : Get GKE credentials
147- uses : google-github-actions/get-gke-credentials@v3.0.0
148- with :
149- cluster_name : ${{ env.GKE_CLUSTER }}
150- location : ${{ env.GKE_ZONE }}
151- project_id : ${{ secrets.GKE_PROJECT }}
152-
153- - name : Install preview
138+ - name : Set preview image reference
154139 id : preview
155- working-directory : ./charts/preview
156140 run : |
157- # add helm jx repo
158- helm repo add jx https://jenkins-x-charts.github.io/v2/
159-
160- # substitute env variables in values.yaml
161- mv values.yaml values.yaml.tosubst
162- envsubst < values.yaml.tosubst > values.yaml
163-
164- # update helm deps
165- helm dependency update .
166-
167- helm upgrade --install \
168- --namespace ${PREVIEW_NAMESPACE} \
169- --create-namespace \
170- ${PREVIEW_NAMESPACE} .
171-
172- # ensure the deployment is restarted to pull the new preview image
173- kubectl rollout restart deployment ${PREVIEW_NAMESPACE}-preview --namespace ${PREVIEW_NAMESPACE}
174-
175- echo "url=https://preview-${PREVIEW_NAMESPACE}.webui.dev.nuxeo.com" >> $GITHUB_OUTPUT
176- echo "PREVIEW_URL=https://preview-${PREVIEW_NAMESPACE}.webui.dev.nuxeo.com" >> $GITHUB_ENV
141+ echo "image=${{ env.REGISTRY }}/${{ env.REPOSITORY }}:${{ env.VERSION }}" >> $GITHUB_OUTPUT
142+ echo "PREVIEW_IMAGE=${{ env.REGISTRY }}/${{ env.REPOSITORY }}:${{ env.VERSION }}" >> $GITHUB_ENV
177143
178144 - uses : actions/github-script@v9.0.0
179145 if : github.event_name == 'pull_request'
@@ -184,15 +150,15 @@ jobs:
184150 issue_number: context.issue.number,
185151 owner: context.repo.owner,
186152 repo: context.repo.repo,
187- body: `:star: PR built and available [here]( ${process.env.PREVIEW_URL}) `
153+ body: `:star: PR preview image published: \` ${process.env.PREVIEW_IMAGE}\` `
188154 })
189155
190156 result :
191- name : " Result: ${{ needs.preview.outputs.url }}"
157+ name : " Result: ${{ needs.preview.outputs.image }}"
192158 needs : preview
193159 runs-on : ubuntu-latest
194160 permissions :
195161 contents : read
196162 if : github.event_name == 'workflow_dispatch'
197163 steps :
198- - run : echo ${{ needs.preview.outputs.url }}
164+ - run : echo ${{ needs.preview.outputs.image }}
0 commit comments