chore add component variable naming rules and enhance documentation f… #1048
This file contains hidden or 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 and Deploy Coong | ||
| on: | ||
| push: | ||
| branches: | ||
| # stop deploy for now | ||
| - dev-none | ||
| # stop deploy for now | ||
| - release/coong-none | ||
| env: | ||
| PNPM_VERSION: 9.1.4 | ||
| NODE_VERSION: 20 | ||
| GCP_SERVICE_NAME: coong | ||
| PROJECT_CLIENT_PATH: apps/coong-client | ||
| ARTIFACT_CLIENT_NAME: dist-client | ||
| TARGET_DEPLOY_BRANCH: release/coong | ||
| jobs: | ||
| build-client: | ||
| name: Build Client | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Repo | ||
| uses: actions/checkout@master | ||
| - name: Setup Node | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
| - name: Prepare Pnpm | ||
| uses: pnpm/action-setup@v2.2.4 | ||
| with: | ||
| version: ${{ env.PNPM_VERSION }} | ||
| - name: Get pnpm store directory | ||
| id: pnpm-cache | ||
| shell: bash | ||
| run: | | ||
| echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | ||
| - uses: actions/cache@v3 | ||
| name: Setup pnpm cache | ||
| with: | ||
| path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | ||
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-pnpm-store- | ||
| - name: Install Dependencies | ||
| run: pnpm install | ||
| - name: Unit Test | ||
| run: pnpm run test | ||
| - name: Build | ||
| run: pnpm run build:coong-client | ||
| - name: Archive Production Artifact | ||
| uses: actions/upload-artifact@master | ||
| with: | ||
| retention-days: 1 | ||
| name: ${{ env.ARTIFACT_CLIENT_NAME }} | ||
| path: | | ||
| ${{ env.PROJECT_CLIENT_PATH }}/dist | ||
| deploy-client: | ||
| name: Deploy Client | ||
| needs: build-client | ||
| runs-on: ubuntu-latest | ||
| # only master | ||
| if: github.ref == 'refs/heads/${{ env.TARGET_DEPLOY_BRANCH }}' | ||
| env: | ||
| DESTINATION: coong-static-production | ||
| steps: | ||
| - name: Checkout Repo | ||
| uses: actions/checkout@master | ||
| - name: Download Artifact | ||
| uses: actions/download-artifact@master | ||
| with: | ||
| name: ${{ env.ARTIFACT_CLIENT_NAME }} | ||
| path: ${{ env.PROJECT_CLIENT_PATH }}/dist | ||
| - id: auth | ||
| name: Authenticate to Google Cloud | ||
| uses: google-github-actions/auth@v1 | ||
| with: | ||
| credentials_json: ${{ secrets.GCP_CREDENTIALS }} | ||
| - id: upload-file | ||
| uses: google-github-actions/upload-cloud-storage@v2 | ||
| with: | ||
| path: ${{ env.PROJECT_CLIENT_PATH }}/dist/spa | ||
| parent: false | ||
| destination: ${{ env.DESTINATION }} | ||