Skip to content

Commit

Permalink
[MOSIP-29251] Updated workflows as per reusable workflow format (#77)
Browse files Browse the repository at this point in the history
* [MOSIP-29251] Updated workflows as per reusable workflow format

[MOSIP-25631]

Signed-off-by: syed salman <[email protected]>

* [MOSIP-29251] updated push-trigger.yml

[MOSIP-25631]

Signed-off-by: syed salman <[email protected]>

---------

Signed-off-by: syed salman <[email protected]>
  • Loading branch information
syedsalman3753 authored Oct 30, 2023
1 parent 46c97f5 commit d1002c2
Show file tree
Hide file tree
Showing 6 changed files with 194 additions and 152 deletions.
156 changes: 156 additions & 0 deletions .github/workflows/push-trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
name: Build and Push

on:
workflow_dispatch:
inputs:
source_directory:
description: 'Provide mosip plugin utility'
required: true
default: 'sign-in-with-esignet or secure-biometric-interface-integrator or storybook-example'
type: string
destination_branch:
description: 'Provide artifactory branch'
required: true
type: string
push:
branches:
- develop
- master
- 0.*
- 1.*
- MOSIP*
- release*
pull_request:
types: [ opened, synchronize, reopened ]

jobs:
build-sign-in-with-esignet:
if: "${{ contains(github.event.inputs.source_directory, 'sign-in-with-esignet') || github.event_name == 'pull_request' || github.event_name == 'push' || false }}"
uses: mosip/kattu/.github/workflows/npm-build.yml@master
with:
SERVICE_LOCATION: ./sign-in-with-esignet
BUILD_ARTIFACT: dist
secrets:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

sign-in-with-esignet:
runs-on: ubuntu-latest
needs: build-sign-in-with-esignet
env:
SERVICE_LOCATION: ./sign-in-with-esignet
DIST_BUILD_ARTIFACT: dist
BUILD_ARTIFACT: sign-in-with-esignet
steps:
- name: Checkout repository
uses: actions/checkout@v3

- uses: actions/download-artifact@v3
with:
name: ${{ env.DIST_BUILD_ARTIFACT }}
path: ${{ env.SERVICE_LOCATION }}

- name: Zip dist directory
run: |
cd ${{ env.SERVICE_LOCATION }}
unzip ${{ env.DIST_BUILD_ARTIFACT }}
mv dist sign-in-with-esignet
zip -r sign-in-with-esignet.zip sign-in-with-esignet/
- name: Upload ZIP artifact
uses: actions/upload-artifact@v3
with:
name: sign-in-with-esignet
path: sign-in-with-esignet/sign-in-with-esignet.zip

- name: Copy ZIP file to mosip-plugins directory
run: |
mkdir -p mosip-plugins
cp ./sign-in-with-esignet/sign-in-with-esignet.zip mosip-plugins/
- name: Pushes mosip-plugin folder
uses: datalbry/[email protected]
env:
API_TOKEN_GITHUB: ${{ secrets.ACTION_PAT }}
with:
source_folder: mosip-plugins
destination_repo: mosip/artifactory-ref-impl
destination_folder: artifacts/src/mosip-plugins/sign-in-with-esignet/
destination_branch: ${{ github.event.inputs.destination_branch }}
user_name: mosip
if: "${{ github.event_name != 'pull_request' }}"

- uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,message,author,commit,workflow,job # 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.

build-secure-biometric-interface-integrator:
if: "${{ contains(github.event.inputs.source_directory, 'secure-biometric-interface-integrator') || github.event_name == 'pull_request' || github.event_name == 'push' || false }}"
uses: mosip/kattu/.github/workflows/npm-build.yml@master
with:
SERVICE_LOCATION: ./secure-biometric-interface-integrator
BUILD_ARTIFACT: dist-sbi-integrator
secrets:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

secure-biometric-interface-integrator:
if: "${{ github.event_name != 'pull_request' }}"
needs: build-secure-biometric-interface-integrator
uses: mosip/kattu/.github/workflows/npm-publish-to-npm-registry.yml@master
with:
SERVICE_LOCATION: ./secure-biometric-interface-integrator
secrets:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

storybook-example:
if: "${{ contains(github.event.inputs.source_directory, 'storybook-example') || github.event_name == 'pull_request' || github.event_name == 'push' || false }}"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: npm Install and Build storybook-example
run: |
cd storybook-example
npm install
npm run build:version:production
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.ACTION_PAT }}
publish_dir: storybook-example/storybook-static
if: "${{ github.event_name != 'pull_request' }}"

- uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,message,author,commit,workflow,job # 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.

sonarcloud:
if: "${{ github.event_name != 'pull_request' }}"
name: SonarCloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,message,author,commit,workflow,job # 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.
123 changes: 0 additions & 123 deletions .github/workflows/push_trigger.yml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/storybook_trigger.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
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 }}
secrets:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ yarn-debug.log*
yarn-error.log*
.VSCodeCounter
*/storybook-static
storybook-example/types
storybook-example/types
.idea
1 change: 1 addition & 0 deletions secure-biometric-interface-integrator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"secure-biometric-interface-integrator"
],
"scripts": {
"verify": "npm run build",
"start": "rollup -c -w",
"build": "rollup -c",
"package": "rollup -c && npm pack",
Expand Down

0 comments on commit d1002c2

Please sign in to comment.