BN-200 | Add. Appointment Number Search Extension In Search Patient Widget #500
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Publish | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| env: | |
| IMAGE_NAME: bahmni/bahmni-apps-frontend | |
| NODE_VERSION: "22" | |
| jobs: | |
| lint-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: "yarn" | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Lint code | |
| run: npx nx run-many --target=lint | |
| # - name: Lint styles | |
| # run: yarn lint:styles | |
| - name: Run tests | |
| run: npx nx run-many --target=test | |
| - name: Scan for package vulnerabilities | |
| uses: aquasecurity/trivy-action@0.30.0 | |
| with: | |
| scan-type: "fs" | |
| format: "table" | |
| exit-code: "1" | |
| severity: "CRITICAL,HIGH" | |
| build-and-publish: | |
| needs: lint-and-test | |
| if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| env: | |
| HELM_CHART_PATH: helm/ | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set env.ARTIFACT_VERSION | |
| run: | | |
| wget -q https://raw.githubusercontent.com/Bahmni/bahmni-infra-utils/main/setArtifactVersion.sh && chmod +x setArtifactVersion.sh | |
| ./setArtifactVersion.sh .appversion | |
| rm setArtifactVersion.sh | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: "yarn" | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Build | |
| run: npx nx build distro | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
| # Build and push to a temporary tag for scanning | |
| - name: Build and push multi-arch image (temp) | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: docker/Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: | | |
| ${{ env.IMAGE_NAME }}:scan-${{ github.sha }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| # Scan the pushed image | |
| - name: Scan Docker image for vulnerabilities | |
| uses: aquasecurity/trivy-action@0.30.0 | |
| with: | |
| image-ref: "${{ env.IMAGE_NAME }}:scan-${{ github.sha }}" | |
| format: "table" | |
| exit-code: "1" | |
| severity: "CRITICAL" | |
| # If scan passes, tag the image with final tags | |
| - name: Tag image with final tags | |
| if: success() | |
| run: | | |
| # Tag the scanned image with final tags | |
| docker buildx imagetools create \ | |
| --tag ${{ env.IMAGE_NAME }}:latest \ | |
| --tag ${{ env.IMAGE_NAME }}:${{ env.ARTIFACT_VERSION }} \ | |
| ${{ env.IMAGE_NAME }}:scan-${{ github.sha }} | |
| - name: Update Version and Image Tag | |
| run: | | |
| yq --inplace '.image.tag = "${{ env.ARTIFACT_VERSION }}"' $HELM_CHART_PATH/values.yaml | |
| yq --inplace '.version = "${{ env.ARTIFACT_VERSION }}"' $HELM_CHART_PATH/Chart.yaml | |
| - name: Helm Lint | |
| run: helm lint $HELM_CHART_PATH | |
| - name: Helm Package | |
| run: helm package $HELM_CHART_PATH | |
| - name: Checkout Charts Repository | |
| uses: actions/checkout@v2 | |
| with: | |
| repository: Bahmni/helm-charts | |
| ref: gh-pages | |
| path: helm-charts | |
| persist-credentials: false | |
| - name: Copy Helm Archive | |
| run: mkdir -p helm-charts/bahmni-apps-frontend/ && cp bahmni-apps-frontend-${{ env.ARTIFACT_VERSION }}.tgz helm-charts/bahmni-apps-frontend/ | |
| - name: Helm Index | |
| working-directory: helm-charts/ | |
| run: helm repo index --merge index.yaml --url https://bahmni.github.io/helm-charts/ . | |
| - name: Commit and Push Chart Repository | |
| working-directory: helm-charts/ | |
| run: | | |
| git config user.name ${{ secrets.BAHMNI_USERNAME}} | |
| git config user.email ${{ secrets.BAHMNI_EMAIL}} | |
| git add . | |
| git commit -m "Release of bahmni-apps-frontend-${{ env.ARTIFACT_VERSION }}" | |
| git push 'https://${{ secrets.BAHMNI_USERNAME}}:${{ secrets.BAHMNI_PAT}}@github.com/bahmni/helm-charts.git' gh-pages |