chore: clean up MOSIP code #282
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
# This Source Code Form is subject to the terms of the Mozilla Public | |
# License, v. 2.0. If a copy of the MPL was not distributed with this | |
# file, You can obtain one at https://mozilla.org/MPL/2.0/. | |
# | |
# OpenCRVS is also distributed under the terms of the Civil Registration | |
# & Healthcare Disclaimer located at http://opencrvs.org/license. | |
# | |
# Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS. | |
name: Build and Deploy Storybook to Cloudflare Pages | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
- release-v* | |
issue_comment: | |
types: | |
- created | |
jobs: | |
build: | |
if: github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
repository: 'opencrvs/opencrvs-core' | |
ref: ${{ github.ref }} | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install | |
- name: Build components | |
run: cd packages/components && yarn build | |
- name: Build Storybook | |
run: cd packages/components && yarn build-storybook | |
- name: Deploy | |
run: npx wrangler pages deploy ./packages/components/build --project-name opencrvs --branch ${{ github.ref_name }} | |
env: | |
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
comment-check: | |
if: github.event_name == 'issue_comment' && github.event.comment.body == '/uikit' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
repository: 'opencrvs/opencrvs-core' | |
- name: Get the PR branch name | |
id: get_branch | |
run: | | |
echo "PR_BRANCH=$(gh pr view ${{ github.event.issue.number }} --json headRefName --jq .headRefName)" >> $GITHUB_ENV | |
env: | |
GITHUB_TOKEN: ${{ secrets.OLLIE_BOT_GITHUB_TOKEN }} | |
- name: Checkout PR branch | |
uses: actions/checkout@v3 | |
with: | |
repository: 'opencrvs/opencrvs-core' | |
ref: ${{ env.PR_BRANCH }} | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install | |
- name: Build components | |
run: cd packages/components && yarn build | |
- name: Build Storybook | |
run: cd packages/components && yarn build-storybook | |
- name: Deploy Storybook to Cloudflare Pages | |
id: deploy_storybook | |
run: | | |
DEPLOY_OUTPUT=$(npx wrangler pages deploy ./packages/components/build --project-name opencrvs --branch ${{ env.PR_BRANCH }}) | |
echo "$DEPLOY_OUTPUT" | |
DEPLOY_URL=$(echo "$DEPLOY_OUTPUT" | grep -o 'https://.*.dev' | tail -n 1) | |
echo "storybook_url=$DEPLOY_URL" >> $GITHUB_OUTPUT | |
env: | |
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
- name: Comment on PR with Storybook link | |
run: | | |
COMMENT="Storybook deployed: ${{ steps.deploy_storybook.outputs.storybook_url }}" | |
gh pr comment ${{ github.event.issue.number }} --body "$COMMENT" | |
env: | |
GITHUB_TOKEN: ${{ secrets.OLLIE_BOT_GITHUB_TOKEN }} |