1
+ name : Build and release Extension Catalog Image to registry
2
+
3
+ on :
4
+ workflow_call :
5
+ inputs :
6
+ registry_target :
7
+ required : true
8
+ type : string
9
+ repository_name :
10
+ required : true
11
+ type : string
12
+ registry_user :
13
+ required : true
14
+ type : string
15
+ outputs :
16
+ build-extension-catalog-job-status :
17
+ value : ${{ jobs.build-extension-catalog.outputs.build-status }}
18
+
19
+ jobs :
20
+ build-and-push-extension-catalog :
21
+ name : Build container image
22
+ if : github.ref_type == 'tag' || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request')
23
+ runs-on : ubuntu-latest
24
+ permissions :
25
+ actions : write
26
+ contents : read
27
+ packages : write
28
+ id-token : write
29
+ outputs :
30
+ build-status : ${{ job.status }}
31
+ steps :
32
+ - name : Read Secrets
33
+ uses : rancher-eio/read-vault-secrets@main
34
+ with :
35
+ secrets : |
36
+ secret/data/github/repo/${{ github.repository }}/dockerhub/rancher/credentials username | DOCKER_USERNAME ;
37
+ secret/data/github/repo/${{ github.repository }}/dockerhub/rancher/credentials password | DOCKER_PASSWORD ;
38
+
39
+ - name : Checkout repository (normal flow)
40
+ uses : actions/checkout@v4
41
+
42
+ - name : Enable Corepack
43
+ run : corepack enable
44
+
45
+ - name : Configure Git
46
+ run : |
47
+ git config user.name 'github-actions[bot]'
48
+ git config user.email 'github-actions[bot]@users.noreply.github.com'
49
+
50
+ - name : Login to Docker Hub
51
+ uses : docker/login-action@v3
52
+ with :
53
+ username : ${{ env.DOCKER_USERNAME }}
54
+ password : ${{ env.DOCKER_PASSWORD }}
55
+
56
+ - name : Setup Helm
57
+ uses : azure/setup-helm@v3
58
+ with :
59
+ version : v3.8.0
60
+
61
+ - name : Setup Nodejs with yarn caching
62
+ uses : actions/setup-node@v4
63
+ with :
64
+ node-version : ' 20'
65
+ cache : yarn
66
+
67
+ - name : Install dependencies
68
+ run : yarn
69
+
70
+ - name : Build and push UI image
71
+ run : |
72
+ publish="yarn publish-pkgs -c -r ${{ inputs.registry_target }} -o ${{ inputs.registry_user }}"
73
+ $publish
74
+
75
+ REPO_NAME=$(echo "${{ github.repository }}" | cut -d'/' -f2)
76
+ IMAGE_VERSION=$(cat package.json | jq .version | sed 's/"//g')
77
+ FULL_IMAGE_NAME=$(echo ${{ inputs.registry_target }}/${{ inputs.registry_user }}/ui-extension-$REPO_NAME:$IMAGE_VERSION)
78
+ IMAGE_ID=$(docker inspect --format='{{.Id}}' $FULL_IMAGE_NAME)
79
+
80
+ docker tag $IMAGE_ID ${{ inputs.registry_target }}/${{ inputs.registry_user }}/${{ inputs.repository_name }}:$IMAGE_VERSION
81
+ docker push ${{ inputs.registry_target }}/${{ inputs.registry_user }}/${{ inputs.repository_name }}:$IMAGE_VERSION
0 commit comments