diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index ef817445..00000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,61 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: Build npm - -# Controls when the action will run. Triggers the workflow on push or pull request -# events but only for the master branch -on: - push: - branches: [ master, 1.0.* ] - pull_request: - branches: [ master, 1.0.* ] - -# 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-resident-ui: - runs-on: ubuntu-latest - env: - NAMESPACE: ${{ secrets. dev_namespace_docker_hub }} - SERVICE_NAME: resident-ui - SERVICE_LOCATION: resident-ui - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - - - name: npm install - run: cd ${{ env.SERVICE_LOCATION }} && npm install --ignore-scripts - - - name: npm build - run: cd ${{ env.SERVICE_LOCATION }} && npm run-script build -- --prod --base-href . --output-path=dist - - - name: setup environment - run: | - # Strip git ref prefix from version - echo "::set-env name=BRANCH_NAME::$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" - echo ${{ env.BRANCH_NAME }} - - - name: Build image - run: | - cd "./${{env.SERVICE_LOCATION}}" - docker build . --file Dockerfile --tag ${{ env.SERVICE_NAME }} - - - name: Log into registry - run: echo "${{ secrets.release_docker_hub }}" | docker login -u ${{ secrets.actor_docker_hub }} --password-stdin - - - name: Push image - run: | - IMAGE_ID=$NAMESPACE/$SERVICE_NAME - - # Change all uppercase to lowercase - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - VERSION=$BRANCH_NAME - echo "push version $VERSION" - echo IMAGE_ID=$IMAGE_ID - echo VERSION=$VERSION - docker tag $SERVICE_NAME $IMAGE_ID:$VERSION - docker push $IMAGE_ID:$VERSION - diff --git a/.github/workflows/push-trigger.yml b/.github/workflows/push-trigger.yml new file mode 100644 index 00000000..2f8df981 --- /dev/null +++ b/.github/workflows/push-trigger.yml @@ -0,0 +1,60 @@ +name: Resident-ui build upon a push + +on: + release: + types: [published] + pull_request: + types: [opened] + push: + branches: + - '!release-branch' + - release-1* + - master + - develop + - 1* + - MOSIP* + +jobs: + build-resident-ui: + uses: mosip/kattu/.github/workflows/npm-build.yml@master + with: + SERVICE_LOCATION: ./resident-ui + BUILD_ARTIFACT: resident-ui + secrets: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} + + build-docker-resident-ui: + needs: build-resident-ui + strategy: + matrix: + include: + - SERVICE_LOCATION: './resident-ui' + SERVICE_NAME: 'resident-ui' + NPM_BUILD: true + BUILD_ARTIFACT: 'resident-ui' + fail-fast: false + name: ${{ matrix.SERVICE_NAME }} + uses: mosip/kattu/.github/workflows/docker-build.yml@master + with: + SERVICE_LOCATION: ${{ matrix.SERVICE_LOCATION }} + SERVICE_NAME: ${{ matrix.SERVICE_NAME }} + NPM_BUILD: ${{ matrix.NPM_BUILD }} + BUILD_ARTIFACT: ${{ matrix.BUILD_ARTIFACT }} + secrets: + DEV_NAMESPACE_DOCKER_HUB: ${{ secrets.DEV_NAMESPACE_DOCKER_HUB }} + ACTOR_DOCKER_HUB: ${{ secrets.ACTOR_DOCKER_HUB }} + RELEASE_DOCKER_HUB: ${{ secrets.RELEASE_DOCKER_HUB }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} + + sonar-analysis: + needs: build-resident-ui + if: "${{ github.event_name != 'pull_request' }}" + uses: mosip/kattu/.github/workflows/npm-sonar-analysis.yml@master + with: + SERVICE_LOCATION: ./resident-ui + SONAR_URL: 'https://sonarcloud.io' + PROJECT_KEY: "mosip_${{ github.event.repository.name }}" + secrets: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + ORG_KEY: ${{ secrets.ORG_KEY }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} diff --git a/.github/workflows/push_trigger.yml b/.github/workflows/push_trigger.yml deleted file mode 100644 index 41773adb..00000000 --- a/.github/workflows/push_trigger.yml +++ /dev/null @@ -1,116 +0,0 @@ -name: Maven Package upon a push - -on: - push: - branches: - - master - - 1.0.* - - develop - - 1.1.* - - MOSIP-11719 - - 1.2.* - - release-1* - -jobs: - build-resident-ui: - runs-on: ubuntu-latest - env: - NAMESPACE: ${{ secrets. dev_namespace_docker_hub }} - SERVICE_NAME: resident-ui - SERVICE_LOCATION: resident-ui - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - with: - node-version: '14' - - - name: npm install - run: cd ${{ env.SERVICE_LOCATION }} && npm install --ignore-scripts - - - name: npm build - run: cd ${{ env.SERVICE_LOCATION }} && npm run-script build -- --prod --base-href . --output-path=dist - - - name: Setup branch and env - run: | - # Strip git ref prefix from version - echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV - echo "GPG_TTY=$(tty)" >> $GITHUB_ENV - - - name: setup environment - run: | - # Strip git ref prefix from version - echo "GPG_TTY=$(tty)" >> $GITHUB_ENV - echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV - - - name: Build image - run: | - cd "./${{env.SERVICE_LOCATION}}" - docker build . --file Dockerfile --tag ${{ env.SERVICE_NAME }} - - - name: Log into registry - run: echo "${{ secrets.release_docker_hub }}" | docker login -u ${{ secrets.actor_docker_hub }} --password-stdin - - - name: Push image - run: | - IMAGE_ID=$NAMESPACE/$SERVICE_NAME - # Change all uppercase to lowercase - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - VERSION=$BRANCH_NAME - echo "push version $VERSION" - echo IMAGE_ID=$IMAGE_ID - echo VERSION=$VERSION - docker tag $SERVICE_NAME $IMAGE_ID:$VERSION - docker push $IMAGE_ID:$VERSION - - sonar-analysis: - runs-on: ubuntu-latest - env: - NAMESPACE: ${{ secrets. dev_namespace_docker_hub }} - SERVICE_NAME: resident-ui - SERVICE_LOCATION: resident-ui - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - with: - node-version: '14' - - - name: npm install - run: cd ${{ env.SERVICE_LOCATION }} && npm install --ignore-scripts && npm install -g npm-install-peers - - - name: npm build - run: cd ${{ env.SERVICE_LOCATION }} && npm run-script build -- --prod --base-href . --output-path=dist - - - name: Setup branch and env - run: | - # Strip git ref prefix from version - echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV - echo "GPG_TTY=$(tty)" >> $GITHUB_ENV - - name: setup environment - run: | - # Strip git ref prefix from version - echo "GPG_TTY=$(tty)" >> $GITHUB_ENV - echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV - - name: run sonar analysis - run: | - cd "./${{env.SERVICE_LOCATION}}" - echo "sonar.host.url=https://sonarcloud.io/ - sonar.login=${{ secrets.SONAR_TOKEN }} - sonar.projectKey=mosip_resident-ui - sonar.organization=${{ secrets.ORG_KEY }} - sonar.sourceEncoding=UTF-8 - sonar.sources=src - sonar.exclusions=**/node_modules/** - sonar.tests=src - sonar.test.inclusions=**/*.spec.ts - sonar.typescript.lcov.reportPaths=coverage/lcov.info" >> sonar-project.properties - npm install sonar-scanner && npm run sonar - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - diff --git a/.github/workflows/release-changes.yml b/.github/workflows/release-changes.yml new file mode 100644 index 00000000..0857aee9 --- /dev/null +++ b/.github/workflows/release-changes.yml @@ -0,0 +1,28 @@ +name: Release/pre-release Preparation. + +on: + workflow_dispatch: + inputs: + MESSAGE: + description: 'Triggered for release or pe-release' + required: false + default: 'Release Preparation' + RELEASE_TAG: + description: 'tag to update' + required: true + SNAPSHOT_TAG: + description: 'tag to be replaced' + required: true + BASE: + description: 'base branch for PR' + required: true +jobs: + maven-release-preparation: + uses: mosip/kattu/.github/workflows/release-changes.yml@master + with: + MESSAGE: ${{ inputs.MESSAGE }} + RELEASE_TAG: ${{ inputs.RELEASE_TAG }} + SNAPSHOT_TAG: ${{ inputs.SNAPSHOT_TAG }} + BASE: ${{ inputs.BASE }} + secrets: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} \ No newline at end of file diff --git a/.github/workflows/release_trigger.yml b/.github/workflows/release_trigger.yml deleted file mode 100644 index 8fd6344d..00000000 --- a/.github/workflows/release_trigger.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: Release maven packages and docker upon a release - -on: - release: - types: [published] - -jobs: - build-resident-ui: - runs-on: ubuntu-latest - env: - NAMESPACE: ${{ secrets. dev_namespace_docker_hub }} - SERVICE_NAME: resident-ui - SERVICE_LOCATION: resident-ui - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - - - name: npm install - run: cd ${{ env.SERVICE_LOCATION }} && npm install --ignore-scripts - - - name: npm build - run: cd ${{ env.SERVICE_LOCATION }} && npm run-script build -- --prod --base-href . --output-path=dist - - - name: Setup branch and env - run: | - # Strip git ref prefix from version - echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV - echo "GPG_TTY=$(tty)" >> $GITHUB_ENV - - - name: setup environment - run: | - # Strip git ref prefix from version - echo "GPG_TTY=$(tty)" >> $GITHUB_ENV - echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV - - - name: run sonar analysis - run: | - cd "./${{env.SERVICE_LOCATION}}" - echo "sonar.host.url=https://sonarcloud.io/ - sonar.login=${{ secrets.SONAR_TOKEN }} - sonar.projectKey=mosip_resident-ui - sonar.organization=${{ secrets.ORG_KEY }} - sonar.sourceEncoding=UTF-8 - sonar.sources=src - sonar.exclusions=**/node_modules/** - sonar.tests=src - sonar.test.inclusions=**/*.spec.ts - sonar.typescript.lcov.reportPaths=coverage/lcov.info" >> sonar-project.properties - npm install sonar-scanner && npm run sonar - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - - - name: Build image - run: | - cd "./${{env.SERVICE_LOCATION}}" - docker build . --file Dockerfile --tag ${{ env.SERVICE_NAME }} - - - name: Log into registry - run: echo "${{ secrets.release_docker_hub }}" | docker login -u ${{ secrets.actor_docker_hub }} --password-stdin - - - name: Push image - run: | - IMAGE_ID=$NAMESPACE/$SERVICE_NAME - # Change all uppercase to lowercase - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - VERSION=$BRANCH_NAME - echo "push version $VERSION" - echo IMAGE_ID=$IMAGE_ID - echo VERSION=$VERSION - docker tag $SERVICE_NAME $IMAGE_ID:$VERSION - docker push $IMAGE_ID:$VERSION -# - uses: 8398a7/action-slack@v3 -# with: -# status: ${{ job.status }} -# fields: repo,message,commit,author,action,eventName,ref,workflow,job,took # selectable (default: repo,message) -# env: -# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} # required -# if: failure() # Pick up events even if the job fails or is canceled. - diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml new file mode 100644 index 00000000..c4939a6e --- /dev/null +++ b/.github/workflows/tag.yml @@ -0,0 +1,33 @@ +name: Tagging of repos + +on: + workflow_dispatch: + inputs: + TAG: + description: 'Tag to be published' + required: true + type: string + BODY: + description: 'Release body message' + required: true + default: 'Changes in this Release' + type: string + PRE_RELEASE: + description: 'Pre-release? True/False' + required: true + default: False + type: string + DRAFT: + description: 'Draft? True/False' + required: false + default: False + type: string + +jobs: + tag-branch: + uses: mosip/kattu/.github/workflows/tag.yml@master + with: + TAG: ${{ inputs.TAG }} + BODY: ${{ inputs.BODY }} + PRE_RELEASE: ${{ inputs.PRE_RELEASE }} + DRAFT: ${{ inputs.DRAFT }}