Update megalinter.yml #193
This file contains 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 pipeline | |
on: | |
push: | |
branches: | |
- master | |
- main | |
- develop | |
- feature/* | |
- hotfix/* | |
pull_request: | |
branches: | |
- master | |
- main | |
- develop | |
- 'release/*' | |
env: | |
SHOULD_PUBLISH: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || startsWith(github.ref , 'refs/heads/release') }} | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
name: Build and Deploy | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
show-progress: false | |
- name: Setup Node.js to use | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Angular CLI install | |
run: npm install -g --silent @angular/[email protected] | |
- name: Set image tag & other env variables | |
run: | | |
VERSION_TAG=$(sed 's/.*"version": "\(.*\)".*/\1/;t;d' ./package.json) | |
echo "VERSION_TAG=$VERSION_TAG" | |
IMAGE_TAGS="${VERSION_TAG}.$(date '+%Y.%m.%d').${{ github.run_number }}" | |
echo "IMAGE_SEMANTIC_HASH=$IMAGE_TAGS" | |
echo "Tags: $IMAGE_TAGS" | |
echo "VERSION_TAG=$VERSION_TAG" >> $GITHUB_ENV | |
echo "IMAGE_SEMANTIC_HASH=$IMAGE_TAGS" >> $GITHUB_ENV | |
echo "IMAGE_TAGS=$IMAGE_TAGS" >> $GITHUB_ENV | |
echo "SHOULD_PUBLISH=$SHOULD_PUBLISH" | |
- name: Install Node Packages | |
run: npm install | |
- name: Docker build | |
uses: docker/[email protected] | |
with: | |
push: false | |
tags: oaftech.azurecr.io/oneacrefund/fineract-frontend-v2:${{ env.IMAGE_TAGS }} | |
context: ${{ github.workspace }} | |
- name: Login to Azure registry | |
uses: docker/[email protected] | |
if: ${{ env.SHOULD_PUBLISH == 'true'}} | |
with: | |
registry: oaftech.azurecr.io | |
username: ${{ vars.ACR_PULL_USERNAME }} | |
password: ${{ secrets.ACR_PULL_PASSWORD }} | |
- name: Push an image to container registry | |
if: ${{ env.SHOULD_PUBLISH == 'true'}} | |
run: docker push oaftech.azurecr.io/oneacrefund/fineract-frontend-v2:${{ env.IMAGE_TAGS }} | |
- name: Use latest image tag | |
run: yq -i '.image.tag = "${{ env.IMAGE_TAGS }}"' ${{ github.workspace }}/deployment/values.yaml | |
- name: Publish configuration package | |
uses: actions/[email protected] | |
if: ${{ env.SHOULD_PUBLISH == 'true'}} | |
with: | |
name: fineract-frontend-v2 | |
path: ${{ github.workspace }}/deployment | |
sonarcloud: | |
name: Sonarcloud analyze | |
runs-on: ubuntu-latest | |
environment: dev | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
fetch-tags: true | |
show-progress: false | |
- uses: actions/setup-node@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install dependencies | |
run: npm install | |
- name: Run Lint and Unit Tests | |
continue-on-error: true | |
run: npm run test:ci | |
- name: Test and coverage | |
continue-on-error: true | |
run: npm run test:cov | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
SONAR_TOKEN: "${{ secrets.SONARCLOUD_TOKEN }}" |