feat: workflow added for generating frontend build #1
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: Continuous Integration for Frontend | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'frontend/**' | ||
pull_request: | ||
types: | ||
- [opened, reopened] | ||
branches: | ||
- main | ||
paths: | ||
- 'frontend/**' | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Install Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16' | ||
- name: Install dependencies | ||
run: | | ||
cd frontend | ||
yarn install | ||
- name: Building app | ||
run: yarn build | ||
- name: Extract branch name | ||
id: extract_branch | ||
run: | | ||
if [[ ${{ github.ref }} == "refs/heads/development" ]]; then | ||
echo "::set-output name=branch::dev" | ||
elif [[ ${{ github.ref }} == "refs/heads/staging" ]]; then | ||
echo "::set-output name=branch::staging" | ||
elif [[ ${{ github.ref }} == "refs/heads/main" ]]; then | ||
echo "::set-output name=branch::prod" | ||
else | ||
echo "Error: Invalid branch name" | ||
exit 1 | ||
fi | ||
- name: push frontend build to branch | ||
uses: Healthlane-Technologies/Zango/.github/workflows/sync-docs-to-docs-hub-main.yml@v0.2.0 | ||
with: | ||
source-directory: "backend/src/zango/assets/app_panel/js" | ||
target-directory: "backend/src/zango/assets/app_panel/js" | ||
destination-github-username: ${{github.actor}} | ||
destination-repository-name: "Zango" | ||
commit-message: "Push build to ${{ steps.extract_branch.outputs.branch }}" | ||
target-branch: ${{ steps.extract_branch.outputs.branch }} | ||
secrets: inherit |