|
| 1 | +name: Web-Build and push at ACR |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + CI_BUILD: |
| 7 | + required: true |
| 8 | + type: string |
| 9 | + VERSION: |
| 10 | + required: false |
| 11 | + type: string |
| 12 | + CONTAINER_NAME: |
| 13 | + required: true |
| 14 | + type: string |
| 15 | + NAMESPACE: |
| 16 | + required: true |
| 17 | + type: string |
| 18 | + SERVICE_NAME: |
| 19 | + required: true |
| 20 | + type: string |
| 21 | + CLUSTER_VALUES: |
| 22 | + required: true |
| 23 | + type: string |
| 24 | + |
| 25 | + secrets: |
| 26 | + SELISE_GITHUB_PAT: |
| 27 | + required: true |
| 28 | + AZURE_CREDENTIALS: |
| 29 | + required: true |
| 30 | + AZURE_CONTAINER_REGISTRY: |
| 31 | + required: true |
| 32 | + ClUSTER_RESOURCE_GROUP: |
| 33 | + required: true |
| 34 | + CLUSTER_NAME: |
| 35 | + required: true |
| 36 | + ACR_RESOURCE_GROUP: |
| 37 | + required: true |
| 38 | + |
| 39 | +env: |
| 40 | + SERVICE_TYPE: 'webclient' |
| 41 | + |
| 42 | +jobs: |
| 43 | + integrateWeb: |
| 44 | + permissions: |
| 45 | + contents: read |
| 46 | + id-token: write |
| 47 | + runs-on: ubuntu-latest |
| 48 | + steps: |
| 49 | + #Checks out the repository this file is in |
| 50 | + - uses: actions/checkout@v3 |
| 51 | + with: |
| 52 | + submodules: 'true' |
| 53 | + token: ${{ secrets.SELISE_GITHUB_PAT }} |
| 54 | + |
| 55 | + - name: Update submodule |
| 56 | + run: | |
| 57 | + git submodule update --init |
| 58 | + - name: Set Environment Variables |
| 59 | + uses: ./.github/actions/setvars |
| 60 | + with: |
| 61 | + varFilePath: ./.github/variables/vars.env |
| 62 | + |
| 63 | + # Logs in with your Azure credentials |
| 64 | + - name: Azure login |
| 65 | + uses: azure/login@v1.4.6 |
| 66 | + with: |
| 67 | + creds: ${{ secrets.AZURE_CREDENTIALS }} |
| 68 | + |
| 69 | + - name: Remove invisible CSS classes |
| 70 | + run: | |
| 71 | + sed -i '/<div className="w-full invisible h-0">/s/invisible h-0//g' src/pages/auth/signin/signin-page.tsx |
| 72 | +
|
| 73 | + - name: Build and push image to ACR |
| 74 | + run: | |
| 75 | + az acr build \ |
| 76 | + --image ${{ secrets.AZURE_CONTAINER_REGISTRY }}.azurecr.io/${{ inputs.CONTAINER_NAME }}:${{ github.sha }} \ |
| 77 | + --registry ${{ secrets.AZURE_CONTAINER_REGISTRY }} -g ${{ secrets.ACR_RESOURCE_GROUP }} \ |
| 78 | + --file ${{ env.STORYBOOK_DOCKERFILE }} \ |
| 79 | + --build-arg ci_build=${{ inputs.CI_BUILD }} . |
| 80 | +
|
| 81 | + deployWebToK8s: |
| 82 | + needs: [integrateWeb] |
| 83 | + permissions: |
| 84 | + contents: read |
| 85 | + id-token: write |
| 86 | + runs-on: ubuntu-latest |
| 87 | + steps: |
| 88 | + #Checks out the repository this file is in |
| 89 | + - uses: actions/checkout@v3 |
| 90 | + with: |
| 91 | + submodules: 'true' |
| 92 | + token: ${{ secrets.SELISE_GITHUB_PAT }} |
| 93 | + |
| 94 | + - name: Update submodule |
| 95 | + run: | |
| 96 | + git submodule update --init |
| 97 | + - name: Set Environment Variables |
| 98 | + uses: ./.github/actions/setvars |
| 99 | + with: |
| 100 | + varFilePath: ./.github/variables/vars.env |
| 101 | + |
| 102 | + # Logs in with your Azure credentials |
| 103 | + - name: Azure login |
| 104 | + uses: azure/login@v1.4.6 |
| 105 | + with: |
| 106 | + creds: ${{ secrets.AZURE_CREDENTIALS }} |
| 107 | + - name: pull helm repo |
| 108 | + uses: actions/checkout@v3 |
| 109 | + with: |
| 110 | + repository: SELISEdigitalplatforms/l0-yml-infrastructure-helm |
| 111 | + token: ${{ secrets.SELISE_GITHUB_PAT }} |
| 112 | + |
| 113 | + # Retrieves your Azure Kubernetes Service cluster's kubeconfig file |
| 114 | + - name: Get K8s context |
| 115 | + uses: azure/aks-set-context@v3 |
| 116 | + with: |
| 117 | + resource-group: ${{ secrets.ClUSTER_RESOURCE_GROUP }} |
| 118 | + cluster-name: ${{ secrets.CLUSTER_NAME }} |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | + - name: Add kubelogin |
| 123 | + uses: azure/use-kubelogin@v1 |
| 124 | + with: |
| 125 | + kubelogin-version: "v0.0.24" |
| 126 | + |
| 127 | + - name: Convert kubeconfig to use AAD |
| 128 | + run: | |
| 129 | + kubelogin convert-kubeconfig -l azurecli |
| 130 | + - name: Setup Helm Installer |
| 131 | + uses: Azure/setup-helm@v3.5 |
| 132 | + with: |
| 133 | + token: ${{ secrets.SELISE_GITHUB_PAT }} |
| 134 | + |
| 135 | + - name: Deploy To Kubernetes |
| 136 | + run: | |
| 137 | + helm upgrade \ |
| 138 | + --install ${{inputs.CONTAINER_NAME}} ./new-templates/ecap3-${{env.SERVICE_TYPE}}/ \ |
| 139 | + --namespace=${{inputs.NAMESPACE}} \ |
| 140 | + --values ./${{inputs.CLUSTER_VALUES}}/${{inputs.SERVICE_NAME}}-storybook.values.yaml \ |
| 141 | + --set image.repository=${{ secrets.AZURE_CONTAINER_REGISTRY }}.azurecr.io/${{ inputs.CONTAINER_NAME }} \ |
| 142 | + --set image.tag=${{ github.sha }} \ |
| 143 | + --set fullnameOverride=${{inputs.CONTAINER_NAME}} \ |
| 144 | + --set ingress.hosts[0].paths[0].path="/" |
0 commit comments